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