]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/thread.tex
more files I forgot to commit (wxFile/wxTempFile/wxTextFile docs)
[wxWidgets.git] / docs / latex / wx / thread.tex
1 \section{\class{wxThread}}\label{wxthread}
2
3 A thread is basically a path of execution through a program. Threads are also
4 sometimes calls {\it light-wight processes}, but the fundamental difference
5 between threads and processes is that memory spaces of different processes are
6 separated while all threads share the same address space. While it makes it
7 much easier to share common data between several threads, it also makes much
8 easier to shoot oneself in a leg, so careful use of synchronization objects
9 such as \helpref{mutexes}{wxmutex} and/or \helpref{critical
10 sections}{wxcriticalsection} is recommended.
11
12 \wxheading{Derived from}
13
14 None.
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
26 Default constructor.
27
28 \membersection{wxThread::\destruct{wxThread}}
29
30 \func{}{\destruct{wxThread}}{\void}
31
32 Destroys the wxThread object.
33
34 \membersection{wxThread::Create}\label{wxthreadcreate}
35
36 \func{wxThreadError}{Create}{\void}
37
38 Creates a thread control.
39
40 \wxheading{Return value}
41
42 One 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
55 If {\it defer} is TRUE, defers thread destruction. This function affects the
56 calling thread.
57
58 \membersection{wxThread::Destroy}\label{wxthreaddestroy}
59
60 \func{wxThreadError}{Destroy}{\void}
61
62 Destroys the thread immediately unless the application has specified deferral via \helpref{wxThread::DeferDestroy}{wxthreaddeferdestroy}.
63
64 \wxheading{Return value}
65
66 One 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
78 Gets the thread identifier.
79
80 \membersection{wxThread::GetPriority}\label{wxthreadgetpriority}
81
82 \constfunc{int}{GetPriority}{\void}
83
84 Gets the priority of the thread, between zero and 100.
85
86 The 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
99 Returns TRUE if the thread is alive.
100
101 \membersection{wxThread::IsMain}\label{wxthreadismain}
102
103 \constfunc{bool}{IsMain}{\void}
104
105 Returns TRUE if the calling thread is the main application thread.
106
107 \membersection{wxThread::Join}\label{wxthreadjoin}
108
109 \func{void*}{Join}{\void}
110
111 Waits 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
117 Called 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
123 Sets the priority of the thread, between zero and 100. This must be set before the thread is created.
124
125 The 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}