CreateMutexHandle() private method

private CreateMutexHandle ( bool initiallyOwned, String name, Win32Native securityAttribute, SafeWaitHandle &mutexHandle ) : int
initiallyOwned bool
name String
securityAttribute Win32Native
mutexHandle SafeWaitHandle
return int
            internal void MutexTryCode(object userData)
            {
                SafeWaitHandle safeWaitHandle = null;

                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                }
                finally
                {
                    if (this.m_initiallyOwned)
                    {
                        this.m_cleanupInfo.inCriticalRegion = true;
                        Thread.BeginThreadAffinity();
                        Thread.BeginCriticalRegion();
                    }
                }
                int num = 0;

                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                }
                finally
                {
                    num = Mutex.CreateMutexHandle(this.m_initiallyOwned, this.m_name, this.m_secAttrs, out safeWaitHandle);
                }
                if (safeWaitHandle.IsInvalid)
                {
                    safeWaitHandle.SetHandleAsInvalid();
                    if (this.m_name != null && this.m_name.Length != 0 && 6 == num)
                    {
                        throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", new object[]
                        {
                            this.m_name
                        }));
                    }
                    __Error.WinIOError(num, this.m_name);
                }
                this.m_newMutex = (num != 183);
                this.m_mutex.SetHandleInternal(safeWaitHandle);
                this.m_mutex.hasThreadAffinity = true;
            }