Please examine the below Code. When I run the below code on IIS, its working for me. But when i try to run it remotely, the WaitHandle.WaitAll(resetEvents) is not blocking and is not waiting for all instances of ThreadB to finish. Any idea on what could be causing it?
class ABC
{
ManualResetEvent[] resetEvents;
function StartThreadPool()
{
resetEvents =new ManualResetEvent[20];
for(int i=0; i<20; i++)
{
resetEvents[i]=new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadB), (object) i);
}
WaitHandle.WaitAll(resetEvents);
}
void ThreadB(object index_para)
{
int index =(int)index_para;
resetEvents[index] .Set();
}
}