Call wxThread::Create() from Run() automatically.
In the common case, when Run() is called immediately after Create() and default stack size is used, it's unnecessarily verbose. Just create the thread in Run() if it wasn't done explicitly yet. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1107,6 +1107,14 @@ wxThreadError wxThread::Run()
|
||||
{
|
||||
wxCriticalSectionLocker lock(m_critsect);
|
||||
|
||||
// Create the thread if it wasn't created yet with an explicit
|
||||
// Create() call:
|
||||
if ( !m_internal->GetHandle() )
|
||||
{
|
||||
if ( !m_internal->Create(this, 0) )
|
||||
return wxTHREAD_NO_RESOURCE;
|
||||
}
|
||||
|
||||
wxCHECK_MSG( m_internal->GetState() == STATE_NEW, wxTHREAD_RUNNING,
|
||||
wxT("thread may only be started once after Create()") );
|
||||
|
||||
|
Reference in New Issue
Block a user