public void PulseAll() { lock(this) { Monitor.PulseAll(this); //mutex.Set(); } }
public void countDown() { lock (mutex) { if (remaining > 0) { remaining--; if (remaining <= 0) { mutex.PulseAll(); } } } }