make POSIX and Windows implementation of wxThread::Run() coherently assert when trying to Run() a thread twice; add a test for it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2010-07-25 13:55:36 +00:00
parent 79b7701c0b
commit 89a76d5d2c
3 changed files with 21 additions and 7 deletions

View File

@@ -1077,11 +1077,8 @@ wxThreadError wxThread::Run()
{
wxCriticalSectionLocker lock(m_critsect);
if ( m_internal->GetState() != STATE_NEW )
{
// actually, it may be almost any state at all, not only STATE_RUNNING
return wxTHREAD_RUNNING;
}
wxCHECK_MSG( m_internal->GetState() == STATE_NEW, wxTHREAD_RUNNING,
wxT("thread may only be started once after Create()") );
// the thread has just been created and is still suspended - let it run
return Resume();