]> git.saurik.com Git - wxWidgets.git/commitdiff
wxThread::Kill() doesn't call OnExit() incorrectly
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 20 Mar 2000 17:39:18 +0000 (17:39 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 20 Mar 2000 17:39:18 +0000 (17:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/thread.tex
src/unix/threadpsx.cpp

index 3a86dc67ce7c8ac75931fb31010e1b6a2e54d828..e67f8a688a9a5a09c1a0a7a70117a2b4ac7c4708 100644 (file)
@@ -210,10 +210,11 @@ be used with extreme care (and not used at all whenever possible)!} The resource
 allocated to the thread will not be freed and the state of the C runtime library
 may become inconsistent. Use \helpref{Delete()}{wxthreaddelete} instead.
 
 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.
 
 This function can only be called from another thread context, i.e. a thread
 can not kill itself.
@@ -228,7 +229,8 @@ paused (in the latter case, the thread will be resumed first) - if you do it,
 
 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
 
 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.
 
 
 This function should never be called directly.
 
index c9915fa3b44d2e716c9b9344a39faff28b0d58b6..f0a19482a01340d443029899539ba8cc018a8cbb 100644 (file)
@@ -1260,7 +1260,8 @@ wxThreadError wxThread::Kill()
 #if !HAVE_THREAD_CLEANUP_FUNCTIONS
                 ScheduleThreadForDeletion();
 
 #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
 
                 DeleteThread(this);
 #endif // HAVE_THREAD_CLEANUP_FUNCTIONS