protected override bool ReleaseHandle()
        {
            if (!this.bIsMutex || Environment.HasShutdownStarted)
            {
                return(Win32Native.CloseHandle(base.handle));
            }
            bool flag            = false;
            bool bHandleObtained = false;

            try
            {
                if (!this.bIsReservedMutex)
                {
                    Mutex.AcquireReservedMutex(ref bHandleObtained);
                }
                flag = Win32Native.CloseHandle(base.handle);
            }
            finally
            {
                if (bHandleObtained)
                {
                    Mutex.ReleaseReservedMutex();
                }
            }
            return(flag);
        }
Exemplo n.º 2
0
        override protected bool ReleaseHandle()
        {
            if (!bIsMutex || Environment.HasShutdownStarted)
            {
                return(Win32Native.CloseHandle(handle));
            }

            bool bReturn        = false;
            bool bMutexObtained = false;

            try
            {
                if (!bIsReservedMutex)
                {
                    Mutex.AcquireReservedMutex(ref bMutexObtained);
                }
                bReturn = Win32Native.CloseHandle(handle);
            }
            finally
            {
                if (bMutexObtained)
                {
                    Mutex.ReleaseReservedMutex();
                }
            }
            return(bReturn);
        }
Exemplo n.º 3
0
        override protected bool ReleaseHandle()
        {
#if MONO
            NativeEventCalls.CloseEvent_internal(handle);
            return(true);
#else
#if !FEATURE_CORECLR
            if (!bIsMutex || Environment.HasShutdownStarted)
            {
                return(Win32Native.CloseHandle(handle));
            }

            bool bReturn        = false;
            bool bMutexObtained = false;
            try
            {
                if (!bIsReservedMutex)
                {
                    Mutex.AcquireReservedMutex(ref bMutexObtained);
                }
                bReturn = Win32Native.CloseHandle(handle);
            }
            finally
            {
                if (bMutexObtained)
                {
                    Mutex.ReleaseReservedMutex();
                }
            }
            return(bReturn);
#else
            return(Win32Native.CloseHandle(handle));
#endif
#endif
        }