From Thibault Genessay, "On Windows, when a process tries to spawn one too many thread,

_beginthreadex() fails but OpenThreads still waits on the startup
Block before returning to the caller of OpenThreads::Thread::start().
This causes a deadlock. The return value of _beginthreadex() is
actually checked, but after the call to OpenThreads::Block::block() so
it is basically useless.

Attached is a fix to move the check for the return value of
_beginthreadex() before the call to block(), so that start() can
return to the caller with a non-zero error code. This solves the
problem for me."
This commit is contained in:
Robert Osfield 2009-05-13 08:33:55 +00:00
parent 0de08dad28
commit 0cf92badba

View File

@ -345,13 +345,13 @@ int Thread::start() {
pd->uniqueId = (int)ID;
// wait till the thread has actually started.
pd->threadStartedBlock.block();
if(!pd->tid) {
return -1;
}
// wait till the thread has actually started.
pd->threadStartedBlock.block();
return 0;
}