+ void * const result = m_owner.Entry();
+
+ wxCriticalSectionLocker locker(m_owner.m_critSection);
+
+ // Detached thread will be deleted after returning, so make sure
+ // wxThreadHelper::GetThread will not return an invalid pointer.
+ // And that wxThreadHelper::KillThread will not try to kill
+ // an already deleted thread
+ if ( m_owner.m_kind == wxTHREAD_DETACHED )
+ m_owner.m_thread = NULL;
+
+ return result;