The simplest hack to fix your problem.
In your class of program:
static volatile int ThreadsComplete = 0;
In your "myMethod" at the end before returning:
Interlocked.Increment(ref ThreadsComplete);
In your main method, before returning / ending it:
while(ThreadsComplete < urls.Count) { Thread.Sleep(10); }
The above has essentially cracked the WaitForAll synchronization method.
source
share