protected virtual void OnDispose() { try { object data = DequeueSendMessage(); while (data != null) { if (data is IBuffer) { ((IBuffer)data).Free(); } data = DequeueSendMessage(); } mReceiveArgs.Server = null; mReceiveArgs.Session = null; mBaseNetStream.Dispose(); if (mSslStream != null) { mSslStream.Dispose(); } Server.CloseSession(this); Server = null; ReceiveDispatcher = null; if (Packet != null) { Packet.Dispose(); } mProperties.Clear(); mReceiveMessages.Clear(); mDecodeCompletedArgs = null; } catch { } }
public void Dispose() { #if NETSTANDARD2_0 while (mQueue.TryDequeue(out T result)) ; #else mQueue.Clear(); #endif }
public void Dispose() { #if (NETSTANDARD2_0) while (mQueue.TryDequeue(out T item)) { } #else mQueue.Clear(); #endif }
private bool disposedValue = false; // 要检测冗余调用 protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { mPool.Clear(); } disposedValue = true; } }
public void Clear() { queue.Clear(); bag.Clear(); }
public void Dispose() { mQueue.Clear(); }
public void Dispose() { mEnabled = false; mQueue.Clear(); }