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."

Merged from svn trunk using:

  svn merge -r 10190:10191 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/OpenThreads/win32
This commit is contained in:
Robert Osfield
2009-05-13 08:35:45 +00:00
parent bf5cad7a0c
commit 285240fd2d

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;
}