private void DoWait()
{
lock (this)
{
// NOTE: the callers of this method should in theory
// be able to do simply wait(), but, as a defense
// against thread timing hazards where notifyAll()
// falls to be called, we wait for at most 1 second
// and then return so caller can check if wait
// conditions are satisified:
System.Threading.Monitor.Wait(this, TimeSpan.FromMilliseconds(1000));
}
}