allocated to the thread will not be freed and the state of the C runtime library
may become inconsistent. Use \helpref{Delete()}{wxthreaddelete} instead.
-For detached threads Kill() will also call \helpref{OnExit}{wxthreadonexit}
-and delete the associated C++ object, however this will not happen for
-joinable threads and this means that you will still have to delete the
-wxThread object yourself to avoid memory leaks.
+For detached threads Kill() will also delete the associated C++ object,
+however this will not happen for joinable threads and this means that you will
+still have to delete the wxThread object yourself to avoid memory leaks.
+In neither case \helpref{OnExit}{wxthreadonexit} of the dying thread will be
+called, so no thread-specific cleanup will be performed.
This function can only be called from another thread context, i.e. a thread
can not kill itself.
Called when the thread exits. This function is called in the context of the
thread associated with the wxThread object, not in the context of the main
-thread.
+thread. This function will not be called if the thread was
+\helpref{killed}{wxthreadkill}.
This function should never be called directly.
#if !HAVE_THREAD_CLEANUP_FUNCTIONS
ScheduleThreadForDeletion();
- OnExit();
+ // don't call OnExit() here, it can only be called in the
+ // threads context and we're in the context of another thread
DeleteThread(this);
#endif // HAVE_THREAD_CLEANUP_FUNCTIONS