]> git.saurik.com Git - wxWidgets.git/commitdiff
some more explanations about thread exiting/killing/deleting
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 19 Mar 2000 13:10:02 +0000 (13:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 19 Mar 2000 13:10:02 +0000 (13:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/thread.tex

index ad520dc2c51b932c21c2354dedaee344f8ec5159..3a86dc67ce7c8ac75931fb31010e1b6a2e54d828 100644 (file)
@@ -127,6 +127,18 @@ joinable threads and is the value returned by \helpref{Wait}{wxthreadwait}.
 This function is called by wxWindows itself and should never be called
 directly.
 
+\membersection{wxThread::Exit}\label{wxthreadexit}
+
+\func{void}{Exit}{\param{ExitCode }{exitcode = 0}}
+
+This is a protected function of wxThread class and thus can be called only
+from a derived class. It also can be called only in the context of this
+thread, i.e. a thread can only exit from itself, not from another thread.
+
+This function will terminate the OS thread (i.e. stop the associated path of
+execution) and also delete the associated C++ object for detached threads. 
+\helpref{wxThread::OnExit}{wxthreadonexit} will be called just before exiting.
+
 \membersection{wxThread::GetCPUCount}\label{wxthreadgetcpucount}
 
 \func{static int}{GetCPUCount}{\void}
@@ -198,16 +210,25 @@ 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.
 
-For detached threads Kill() will also delete the associated C++ object.
+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.
 
-This function can only be called from another thread context.
+This function can only be called from another thread context, i.e. a thread
+can not kill itself.
+
+It is also an error to call this function for a thread which is not running or
+paused (in the latter case, the thread will be resumed first) - if you do it, 
+{\tt wxTHREAD\_NOT\_RUNNING} error will be returned.
 
 \membersection{wxThread::OnExit}\label{wxthreadonexit}
 
 \func{void}{OnExit}{\void}
 
-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.
+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.
 
 This function should never be called directly.