wxMutex::wxMutex()
{
p_internal = new wxMutexInternal;
+
pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL );
m_locked = 0;
}
wxThread::ExitCode wxThread::Delete()
{
+ if (IsPaused())
+ Resume();
+
m_critsect.Enter();
wxThreadState state = p_internal->GetState();
// wait until the thread stops
p_internal->Wait();
}
+ //GL: As we must auto-destroy, the destruction must happen here.
+ delete this;
return NULL;
}
return wxTHREAD_MISC_ERROR;
}
+ //GL: As we must auto-destroy, the destruction must happen here (2).
+ delete this;
return wxTHREAD_NO_ERROR;
}
for ( size_t n = 0u; n < count; n++ )
{
- gs_allThreads[n]->Delete();
+ // Delete calls the destructor which removes the current entry. We
+ // should only delete the first one each time.
+ gs_allThreads[0]->Delete();
}
// destroy GUI mutex