Shachar Shemesh wine-devel@shemesh.biz writes:
#define NUMTHREADS 3000
[...] WaitForMultipleObjects(NUMTHREADS, threads, TRUE, INFINITE);
That's probably not the cause of the deadlock, but you can't wait for more than 64 objects with WaitForMultipleObjects, so your code won't wait for the threads to terminate.