예제 #1
0
 public override void LockInterruptibly()
 {
     Thread caller = Thread.CurrentThread;
     lock (this)
     {
         if (_owner == null)
         {
             _owner = caller;
             _holds = 1;
             return;
         }
         else if (caller == _owner)
         {
             ++_holds;
             return;
         }
     }
     WaitNode n = new WaitNode();
     n.DoWait(this);
 }
예제 #2
0
 public override void LockInterruptibly()
 {
     Thread caller = Thread.CurrentThread;
     lock (this)
     {
         if (GetHold(caller)) return;
     }
     WaitNode n = new WaitNode();
     n.DoWait(this);
 }