How to check if the WaitHandle was set?
Try WaitHandle.WaitOne(0) If millisecondsTimeout is zero, the method does not block. It tests the state of the wait handle and returns immediately.
Try WaitHandle.WaitOne(0) If millisecondsTimeout is zero, the method does not block. It tests the state of the wait handle and returns immediately.
Create a variable that keeps track of the number of running tasks: int numberOfTasks = 100; Create a signal: ManualResetEvent signal = new ManualResetEvent(false); Decrement the number of tasks whenever a task is finished: if (Interlocked.Decrement(ref numberOftasks) == 0) { If there is no task remaining, set the signal: signal.Set(); } Meanwhile, somewhere else, wait … Read more