Ejemplo n.º 1
0
 /// <summary>
 /// Dispose this AsyncSocket. Does not close the underlying socket.
 /// </summary>
 public void Dispose()
 {
     // ensure we haven't already disposed
     _syncLock.TakeWrite();
     if (_disposing)
     {
         _syncLock.ReleaseWrite();
         return;
     }
     _disposing = true;
     _syncLock.ReleaseWrite();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Dispose this AsyncSocket. Closes the underlying socket if required.
        /// </summary>
        public void Dispose()
        {
            // ensure we haven't already disposed
            _syncLock.TakeWrite();
            if (_disposing)
            {
                _syncLock.ReleaseWrite();
                return;
            }
            _disposing = true;
            _syncLock.ReleaseWrite();

            // run sender dispose code
            if (_sendSocketArgs != null)
            {
                SocketEventArgsCache.DeallocateForSend(_sendSocketArgs, OnSocketSend);
                _sendSocketArgs = null;
            }
        }