protected virtual void Dispose(bool explicitDisposing) { // Check to see if Dispose has already been called. if (!disposed) { disposed = true; if (os_handle == InvalidHandle) { return; } lock (this) { if (os_handle != InvalidHandle) { NativeEventCalls.CloseEvent_internal(os_handle); os_handle = InvalidHandle; } } } }