Made the behaviour of Thread::Wait consistent across implementations when called from its owner thread
This commit is contained in:
parent
b0ebca9d29
commit
48e30ea0e3
2 changed files with 8 additions and 1 deletions
|
@ -57,7 +57,12 @@ ThreadImpl::~ThreadImpl()
|
|||
void ThreadImpl::Wait()
|
||||
{
|
||||
if (myThread)
|
||||
WaitForSingleObject(myThread, INFINITE);
|
||||
{
|
||||
// The following condition avoids a deadlock if Wait() is called from its
|
||||
// owner thread. This makes the behaviour consistent with the Unix implementation
|
||||
if (GetThreadId(myThread) != GetCurrentThreadId())
|
||||
WaitForSingleObject(myThread, INFINITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue