]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/thread.tex
Watcom C++ mods
[wxWidgets.git] / docs / latex / wx / thread.tex
... / ...
CommitLineData
1\section{\class{wxThread}}\label{wxthread}
2
3A thread is basically a path of execution through a program. Threads are also
4sometimes calls {\it light-wight processes}, but the fundamental difference
5between threads and processes is that memory spaces of different processes are
6separated while all threads share the same address space. While it makes it
7much easier to share common data between several threads, it also makes much
8easier to shoot oneself in a leg, so careful use of synchronization objects
9such as \helpref{mutexes}{wxmutex} and/or \helpref{critical
10sections}{wxcriticalsection} is recommended.
11
12\wxheading{Derived from}
13
14None.
15
16\wxheading{See also}
17
18\helpref{wxMutex}{wxmutex}, \helpref{wxCondition}{wxcondition}
19
20\latexignore{\rtfignore{\wxheading{Members}}}
21
22\membersection{wxThread::wxThread}\label{wxthreadconstr}
23
24\func{}{wxThread}{\void}
25
26Default constructor.
27
28\membersection{wxThread::\destruct{wxThread}}
29
30\func{}{\destruct{wxThread}}{\void}
31
32Destroys the wxThread object.
33
34\membersection{wxThread::Create}\label{wxthreadcreate}
35
36\func{wxThreadError}{Create}{\void}
37
38Creates a thread control.
39
40\wxheading{Return value}
41
42One of:
43
44\twocolwidtha{7cm}
45\begin{twocollist}\itemsep=0pt
46\twocolitem{{\bf wxTHREAD\_NO\_ERROR}}{There was no error.}
47\twocolitem{{\bf wxTHREAD\_NO\_RESOURCE}}{There were insufficient resources to create a new thread.}
48\twocolitem{{\bf wxTHREAD\_RUNNING}}{The thread is already running.}
49\end{twocollist}
50
51\membersection{wxThread::DeferDestroy}\label{wxthreaddeferdestroy}
52
53\func{void}{DeferDestroy}{\param{bool}{ defer}}
54
55If {\it defer} is TRUE, defers thread destruction. This function affects the
56calling thread.
57
58\membersection{wxThread::Destroy}\label{wxthreaddestroy}
59
60\func{wxThreadError}{Destroy}{\void}
61
62Destroys the thread immediately unless the application has specified deferral via \helpref{wxThread::DeferDestroy}{wxthreaddeferdestroy}.
63
64\wxheading{Return value}
65
66One of:
67
68\twocolwidtha{7cm}
69\begin{twocollist}\itemsep=0pt
70\twocolitem{{\bf wxTHREAD\_NO\_ERROR}}{There was no error.}
71\twocolitem{{\bf wxTHREAD\_NOT\_RUNNING}}{The thread is not running.}
72\end{twocollist}
73
74\membersection{wxThread::GetID}\label{wxthreadgetid}
75
76\constfunc{unsigned long}{GetID}{\void}
77
78Gets the thread identifier.
79
80\membersection{wxThread::GetPriority}\label{wxthreadgetpriority}
81
82\constfunc{int}{GetPriority}{\void}
83
84Gets the priority of the thread, between zero and 100.
85
86The following priorities are already defined:
87
88\twocolwidtha{7cm}
89\begin{twocollist}\itemsep=0pt
90\twocolitem{{\bf WXTHREAD\_MIN\_PRIORITY}}{0}
91\twocolitem{{\bf WXTHREAD\_DEFAULT\_PRIORITY}}{50}
92\twocolitem{{\bf WXTHREAD\_MAX\_PRIORITY}}{100}
93\end{twocollist}
94
95\membersection{wxThread::IsAlive}\label{wxthreadisalive}
96
97\constfunc{bool}{IsAlive}{\void}
98
99Returns TRUE if the thread is alive.
100
101\membersection{wxThread::IsMain}\label{wxthreadismain}
102
103\constfunc{bool}{IsMain}{\void}
104
105Returns TRUE if the calling thread is the main application thread.
106
107\membersection{wxThread::Join}\label{wxthreadjoin}
108
109\func{void*}{Join}{\void}
110
111Waits for the termination of the thread. Returns a platform-specific exit code. TODO
112
113\membersection{wxThread::OnExit}\label{wxthreadonexit}
114
115\func{void}{OnExit}{\void}
116
117Called when the thread exits. The default implementation calls \helpref{wxThread::Join}{wxthreadjoin}.
118
119\membersection{wxThread::SetPriority}\label{wxthreadsetpriority}
120
121\func{void}{SetPriority}{\param{int}{ priority}}
122
123Sets the priority of the thread, between zero and 100. This must be set before the thread is created.
124
125The following priorities are already defined:
126
127\twocolwidtha{7cm}
128\begin{twocollist}\itemsep=0pt
129\twocolitem{{\bf WXTHREAD\_MIN\_PRIORITY}}{0}
130\twocolitem{{\bf WXTHREAD\_DEFAULT\_PRIORITY}}{50}
131\twocolitem{{\bf WXTHREAD\_MAX\_PRIORITY}}{100}
132\end{twocollist}