Exemplo n.º 1
0
 public override void SignalAll()
 {
     AssertOwnership();
     for (; ;)
     {
         WaitNode w = _wq.Dequeue();
         if (w == null)
         {
             return;             // no more to signal
         }
         w.Signal(_sync);
     }
 }
Exemplo n.º 2
0
 public override void Signal()
 {
     AssertOwnership();
     for (; ;)
     {
         WaitNode w = _wq.Dequeue();
         if (w == null)
         {
             return;             // no one to signal
         }
         if (w.Signal(_sync))
         {
             return;                  // notify if still waiting, else skip
         }
     }
 }
            public override void Unlock()
            {
                Thread caller = Thread.CurrentThread;

                for (;;)
                {
                    WaitNode w = GetSignallee(caller);
                    if (w == null)
                    {
                        return;            // no one to signal
                    }
                    if (w.Signal(this))
                    {
                        return;                 // notify if still waiting, else skip
                    }
                }
            }