From 285240fd2ddaf63a70820027711685c4007525f4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 13 May 2009 08:35:45 +0000 Subject: [PATCH] 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 --- src/OpenThreads/win32/Win32Thread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenThreads/win32/Win32Thread.cpp b/src/OpenThreads/win32/Win32Thread.cpp index 7e17f8362..5c1099947 100644 --- a/src/OpenThreads/win32/Win32Thread.cpp +++ b/src/OpenThreads/win32/Win32Thread.cpp @@ -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; }