Ejemplo n.º 1
0
        // Called by monitor to see if its lock is held by the current thread.
        internal bool IsOwnedByCurrentThread()
        {
            bool b = MutexHandle.IsOwnedByCurrentThread(handle);

            GC.KeepAlive(this);
            return(b);
        }
Ejemplo n.º 2
0
 //| <include path='docs/doc[@for="MutexHandle.Dispose"]/*' />
 protected override void Dispose(bool explicitDisposing)
 {
     if (handle.id != 0)
     {
         MutexHandle.Dispose(handle);
         handle = new MutexHandle();
     }
 }
Ejemplo n.º 3
0
        //| <include path='docs/doc[@for="Mutex.Mutex3"]/*' />
        public Mutex()
        {
            MutexHandle handleOnStack;

            if (!MutexHandle.Create(false, out handleOnStack))
            {
                throw new HandleCreateException();
            }
            handle = handleOnStack;
        }
Ejemplo n.º 4
0
        //| <include path='docs/doc[@for="Mutex.Mutex2"]/*' />
        public Mutex(bool initiallyOwned)
        {
            MutexHandle handleOnStack;

            if (!MutexHandle.Create(initiallyOwned, out handleOnStack))
            {
                throw new HandleCreateException();
            }
            handle = handleOnStack;
        }
Ejemplo n.º 5
0
 //| <include path='docs/doc[@for="Mutex.ReleaseMutex"]/*' />
 public void ReleaseMutex()
 {
     MutexHandle.Release(handle);
     GC.KeepAlive(this);
 }