From c8d2efcc7222ea9d96e74c8cf268034863555fc3 Mon Sep 17 00:00:00 2001 From: Jakub Bartkowiak Date: Sun, 27 Oct 2019 15:42:38 +0100 Subject: [PATCH] fix: Race condition within BacnetAsyncResult #50 --- BacnetAsyncResult.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BacnetAsyncResult.cs b/BacnetAsyncResult.cs index 10c8cb3..1087bac 100644 --- a/BacnetAsyncResult.cs +++ b/BacnetAsyncResult.cs @@ -11,7 +11,7 @@ public class BacnetAsyncResult : IAsyncResult, IDisposable private readonly int _transmitLength; private readonly bool _waitForTransmit; private readonly TimeSpan _transmitTimeout; - private ManualResetEvent _waitHandle; + private ManualResetEvent _waitHandle = new ManualResetEvent(false); public bool Segmented { get; private set; } public byte[] Result { get; private set; } @@ -48,7 +48,6 @@ public BacnetAsyncResult(BacnetClient comm, BacnetAddress adr, byte invokeId, _comm.OnReject += OnReject; _comm.OnSimpleAck += OnSimpleAck; _comm.OnSegment += OnSegment; - _waitHandle = new ManualResetEvent(false); } public BacnetAsyncResult Send()