+ rc = wxPtrToUInt(thread->Entry());
+ }
+ wxCATCH_ALL( wxTheApp->OnUnhandledException(); )
+
+ return rc;
+}
+
+/* static */
+THREAD_RETVAL THREAD_CALLCONV wxThreadInternal::WinThreadStart(void *param)
+{
+ THREAD_RETVAL rc = THREAD_ERROR_EXIT;
+
+ wxThread * const thread = (wxThread *)param;
+
+ // each thread has its own SEH translator so install our own a.s.a.p.
+ DisableAutomaticSETranslator();
+
+ // NB: Notice that we can't use wxCriticalSectionLocker in this function as
+ // we use SEH and it's incompatible with C++ object dtors.
+
+ // first of all, check whether we hadn't been cancelled already and don't
+ // start the user code at all then
+ thread->m_critsect.Enter();
+ const bool hasExited = thread->m_internal->GetState() == STATE_EXITED;
+ thread->m_critsect.Leave();
+
+ // run the thread function itself inside a SEH try/except block
+ wxSEH_TRY
+ {
+ if ( hasExited )
+ DoThreadOnExit(thread);
+ else
+ rc = DoThreadStart(thread);