Beispiel #1
0
            public void DispatchBuffer(int responseTo, IByteBuffer buffer)
            {
                TaskCompletionSource <ReceiveCoordinatorInstructions> awaiter = null;

                lock (_lock)
                {
                    if (_awaiters.TryGetValue(responseTo, out awaiter))
                    {
                        _awaiters.Remove(responseTo);
                    }
                    else
                    {
                        _buffers.Add(responseTo, buffer);
                    }
                }

                if (awaiter != null)
                {
                    var instructions = new ReceiveCoordinatorInstructions
                    {
                        Action = ReceiveCoordinatorAction.ReturnBuffer,
                        Buffer = buffer
                    };
                    if (!awaiter.TrySetResult(instructions))
                    {
                        buffer.Dispose();
                    }
                }
            }
Beispiel #2
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && !_disposed)
     {
         _buffer.Dispose();
     }
     _disposed = true;
 }
Beispiel #3
0
 /// <inheritdoc/>
 public void Dispose()
 {
     if (!_disposed)
     {
         _disposed = true;
         _buffer.Dispose();
     }
 }
Beispiel #4
0
 // protected methods
 /// <inheritdoc/>
 protected override void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (_ownsBuffer)
         {
             _buffer.Dispose();
         }
         _disposed = true;
     }
     base.Dispose(disposing);
 }
Beispiel #5
0
 public void Dispose()
 {
     if (oldData != null)
     {
         oldData.Dispose();
     }
     if (newData != null)
     {
         newData.Dispose();
     }
     if (windowEncoder != null)
     {
         windowEncoder = null;
     }
 }
Beispiel #6
0
 // protected methods
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             if (_byteBuffer != null)
             {
                 if (_disposeByteBuffer)
                 {
                     _byteBuffer.Dispose();
                 }
                 _byteBuffer = null;
             }
         }
         _disposed = true;
     }
 }
Beispiel #7
0
 // protected methods
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         if (disposing)
         {
             if (_slice != null)
             {
                 _slice.Dispose();
                 _slice = null;
             }
             if (_disposableItems != null)
             {
                 _disposableItems.ForEach(x => x.Dispose());
                 _disposableItems = null;
             }
         }
     }
     base.Dispose(disposing);
 }
Beispiel #8
0
 // protected methods
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             if (_slice != null)
             {
                 _slice.Dispose();
                 _slice = null;
             }
             if (_disposableItems != null)
             {
                 _disposableItems.ForEach(x => x.Dispose());
                 _disposableItems = null;
             }
         }
         _disposed = true;
     }
 }
            public void DispatchBuffer(int responseTo, IByteBuffer buffer)
            {
                TaskCompletionSource<ReceiveCoordinatorInstructions> awaiter = null;

                lock (_lock)
                {
                    if (_awaiters.TryGetValue(responseTo, out awaiter))
                    {
                        _awaiters.Remove(responseTo);
                    }
                    else
                    {
                        _buffers.Add(responseTo, buffer);
                    }
                }

                if (awaiter != null)
                {
                    var instructions = new ReceiveCoordinatorInstructions
                    {
                        Action = ReceiveCoordinatorAction.ReturnBuffer,
                        Buffer = buffer
                    };
                    if (!awaiter.TrySetResult(instructions))
                    {
                        buffer.Dispose();
                    }
                }
            }