WaitForSingleObject does not allocating...
What can make the WaitForSingleObject function to stop allocating me a thread...
The first couple of threads have been allocated and ended successfully, but then it begins to timeout while waiting for a signal...
** Note: it's not the 30000ms timeout time.
I've tried INFINITE but it just kept on waiting...
** Note: I'm using the same semaphore to create the threads.
Thank you very much for all you help.
Code:
hSemaphore = OpenSemaphore(SYNCHRONIZE, 0, THREAD_SEMAPHORE);
if (WaitForSingleObject(hSemaphore, 30000)==WAIT_TIMEOUT)
{
// error
}
ReleaseSemaphore(hSemaphore, 1, (long *)&dwSemCount);
CloseHandle(hSemaphore);