private WaitNode GetSignallee(Thread caller)
{
lock (this)
{
if (caller != _owner)
{
throw new SynchronizationLockException("Not owner");
}
if (_holds >= 2) // current thread will keep the lock
{
--_holds;
return null;
}
var w = _wq.Dequeue();
if (w == null) // if none, clear for new arrivals
{
_owner = null;
_holds = 0;
}
return w;
}
}