a few corrections

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-05-20 15:21:52 +00:00
parent 57eaf1ec46
commit 93b14e8026

View File

@@ -1121,7 +1121,15 @@ void wxThreadInternal::Wait()
// if the thread we're waiting for is waiting for the GUI mutex, we will // if the thread we're waiting for is waiting for the GUI mutex, we will
// deadlock so make sure we release it temporarily // deadlock so make sure we release it temporarily
if ( wxThread::IsMain() ) if ( wxThread::IsMain() )
{
// give the thread we're waiting for chance to do the GUI call
// it might be in, we don't do this conditionally as the to be waited on
// thread might have to acquire the mutex later but before terminating
if ( wxGuiOwnedByMainThread() )
{
wxMutexGuiLeave(); wxMutexGuiLeave();
}
}
{ {
wxCriticalSectionLocker lock(m_csJoinFlag); wxCriticalSectionLocker lock(m_csJoinFlag);
@@ -1150,10 +1158,6 @@ void wxThreadInternal::Wait()
m_shouldBeJoined = FALSE; m_shouldBeJoined = FALSE;
} }
} }
// reacquire GUI mutex
if ( wxThread::IsMain() )
wxMutexGuiEnter();
} }
void wxThreadInternal::Pause() void wxThreadInternal::Pause()
@@ -1197,7 +1201,7 @@ wxThread *wxThread::This()
bool wxThread::IsMain() bool wxThread::IsMain()
{ {
return GetCurrentId() == gs_idMainThread || gs_idMainThread == kNoThreadID; return GetCurrentId() == gs_idMainThread || gs_idMainThread == kInvalidID ;
} }
#ifdef Yield #ifdef Yield
@@ -1408,7 +1412,6 @@ wxThreadError wxThread::Delete(ExitCode *rc)
*rc = m_internal->GetExitCode(); *rc = m_internal->GetExitCode();
} }
} }
//else: can't wait for detached threads
} }
return wxTHREAD_NO_ERROR; return wxTHREAD_NO_ERROR;