|
|
|
@@ -63,7 +63,7 @@ The possible values for {\it kind} parameters are:
|
|
|
|
|
\func{}{\destruct{wxThread}}{\void}
|
|
|
|
|
|
|
|
|
|
The destructor frees the resources associated with the thread. Notice that you
|
|
|
|
|
should never delete a detached thread - you may only call
|
|
|
|
|
should never delete a detached thread - you may only call
|
|
|
|
|
\helpref{Delete}{wxthreaddelete} on it or wait until it terminates (and auto
|
|
|
|
|
destructs) itself. Because the detached threads delete themselves, they can
|
|
|
|
|
only be allocated on the heap.
|
|
|
|
@@ -98,17 +98,17 @@ One of:
|
|
|
|
|
|
|
|
|
|
Calling \helpref{Delete}{wxthreaddelete} is a graceful way to terminate the
|
|
|
|
|
thread. It asks the thread to terminate and, if the thread code is well
|
|
|
|
|
written, the thread will terminate after the next call to
|
|
|
|
|
written, the thread will terminate after the next call to
|
|
|
|
|
\helpref{TestDestroy}{wxthreadtestdestroy} which should happen quite soon.
|
|
|
|
|
|
|
|
|
|
However, if the thread doesn't call \helpref{TestDestroy}{wxthreadtestdestroy}
|
|
|
|
|
However, if the thread doesn't call \helpref{TestDestroy}{wxthreadtestdestroy}
|
|
|
|
|
often enough (or at all), the function will not return immediately, but wait
|
|
|
|
|
until the thread terminates. As it may take a long time, and the message processing
|
|
|
|
|
is not stopped during this function execution, message handlers may be
|
|
|
|
|
called from inside it!
|
|
|
|
|
|
|
|
|
|
Delete() may be called for thread in any state: running, paused or even not yet
|
|
|
|
|
created. Moreover, it must be called if \helpref{Create}{wxthreadcreate} or
|
|
|
|
|
created. Moreover, it must be called if \helpref{Create}{wxthreadcreate} or
|
|
|
|
|
\helpref{Run}{wxthreadrun} failed for a detached thread to free the memory
|
|
|
|
|
occupied by the thread object. This cleanup will be done in the destructor for joinable
|
|
|
|
|
threads.
|
|
|
|
@@ -146,7 +146,7 @@ from a derived class. It also can only be called 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.
|
|
|
|
|
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}
|
|
|
|
@@ -159,6 +159,14 @@ Returns the number of system CPUs or -1 if the value is unknown.
|
|
|
|
|
|
|
|
|
|
\helpref{SetConcurrency}{wxthreadsetconcurrency}
|
|
|
|
|
|
|
|
|
|
\membersection{wxThread::GetCurrentId}\label{wxthreadgetcurrentid}
|
|
|
|
|
|
|
|
|
|
\func{static unsigned long}{GetCurrentId}{\void}
|
|
|
|
|
|
|
|
|
|
Returns the platform specific thread ID of the current thread as a
|
|
|
|
|
long. This can be used to uniquely identify threads, even if they are
|
|
|
|
|
not wxThreads.
|
|
|
|
|
|
|
|
|
|
\membersection{wxThread::GetId}\label{wxthreadgetid}
|
|
|
|
|
|
|
|
|
|
\constfunc{unsigned long}{GetId}{\void}
|
|
|
|
@@ -230,7 +238,7 @@ This function can only be called from another thread context, i.e. a thread
|
|
|
|
|
cannot 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,
|
|
|
|
|
paused (in the latter case, the thread will be resumed first) - if you do it,
|
|
|
|
|
a {\tt wxTHREAD\_NOT\_RUNNING} error will be returned.
|
|
|
|
|
|
|
|
|
|
\membersection{wxThread::OnExit}\label{wxthreadonexit}
|
|
|
|
@@ -239,7 +247,7 @@ a {\tt wxTHREAD\_NOT\_RUNNING} error will be returned.
|
|
|
|
|
|
|
|
|
|
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 will not be called if the thread was
|
|
|
|
|
thread. This function will not be called if the thread was
|
|
|
|
|
\helpref{killed}{wxthreadkill}.
|
|
|
|
|
|
|
|
|
|
This function should never be called directly.
|
|
|
|
@@ -249,7 +257,7 @@ This function should never be called directly.
|
|
|
|
|
\func{wxThreadError}{Pause}{\void}
|
|
|
|
|
|
|
|
|
|
Suspends the thread. Under some implementations (Win32), the thread is
|
|
|
|
|
suspended immediately, under others it will only be suspended when it calls
|
|
|
|
|
suspended immediately, under others it will only be suspended when it calls
|
|
|
|
|
\helpref{TestDestroy}{wxthreadtestdestroy} for the next time (hence, if the
|
|
|
|
|
thread doesn't call it at all, it won't be suspended).
|
|
|
|
|
|
|
|
|
@@ -259,7 +267,7 @@ This function can only be called from another thread context.
|
|
|
|
|
|
|
|
|
|
\func{wxThreadError}{Run}{\void}
|
|
|
|
|
|
|
|
|
|
Starts the thread execution. Should be called after
|
|
|
|
|
Starts the thread execution. Should be called after
|
|
|
|
|
\helpref{Create}{wxthreadcreate}.
|
|
|
|
|
|
|
|
|
|
This function can only be called from another thread context.
|
|
|
|
@@ -269,7 +277,7 @@ This function can only be called from another thread context.
|
|
|
|
|
\func{void}{SetPriority}{\param{int}{ priority}}
|
|
|
|
|
|
|
|
|
|
Sets the priority of the thread, between $0$ and $100$. It can only be set
|
|
|
|
|
after calling \helpref{Create()}{wxthreadcreate} but before calling
|
|
|
|
|
after calling \helpref{Create()}{wxthreadcreate} but before calling
|
|
|
|
|
\helpref{Run()}{wxthreadrun}.
|
|
|
|
|
|
|
|
|
|
The following priorities are already defined:
|
|
|
|
|