Hi to all I have the following situation:
I'm creating a number of threads that does some work and then a then I wait for all the threads to finish, the following is the code I'm using, everything is working fine. Now I want to add the option to pause the threads.
I want to be enable to pause the threads that are working, I read in the web that is very dangerous, is this right, is this possible do this?
I don't want to use the spleep method, because I don't know when they should pause, I want to send them a signal or something like this, pause them and then send them another signal to continue working.
Thanks in advanced :?:

ManualResetEvent[] waitHandles;
waitHandles = new ManualResetEvent[numberOfThreads];
 // loop over the number of threads and create them
for (int i = 0; i < numberOfThreads; i++)
//create a worker thread
waitHandles[i] = new ManualResetEvent(false);
threadClass = new ThreadClass (number);
ThreadPool.QueueUserWorkItem(new WaitCallback(MainThread.ThreadPoolCallback), threadClass);
// wait for all the threads to finish