1 \section{\class{wxThread
}}\label{wxthread
}
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.
12 \wxheading{Derived from
}
18 \helpref{wxMutex
}{wxmutex
},
\helpref{wxCondition
}{wxcondition
}
20 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxThread::wxThread
}\label{wxthreadconstr
}
24 \func{}{wxThread
}{\void}
28 \membersection{wxThread::
\destruct{wxThread
}}
30 \func{}{\destruct{wxThread
}}{\void}
32 Destroys the wxThread object.
34 \membersection{wxThread::Create
}\label{wxthreadcreate
}
36 \func{wxThreadError
}{Create
}{\void}
38 Creates a thread control.
40 \wxheading{Return value
}
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.
}
51 \membersection{wxThread::DeferDestroy
}\label{wxthreaddeferdestroy
}
53 \func{void
}{DeferDestroy
}{\param{bool
}{ defer
}}
55 If
{\it defer
} is TRUE, defers thread destruction. This function affects the
58 \membersection{wxThread::Destroy
}\label{wxthreaddestroy
}
60 \func{wxThreadError
}{Destroy
}{\void}
62 Destroys the thread immediately unless the application has specified deferral via
\helpref{wxThread::DeferDestroy
}{wxthreaddeferdestroy
}.
64 \wxheading{Return value
}
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.
}
74 \membersection{wxThread::GetID
}\label{wxthreadgetid
}
76 \constfunc{unsigned long
}{GetID
}{\void}
78 Gets the thread identifier.
80 \membersection{wxThread::GetPriority
}\label{wxthreadgetpriority
}
82 \constfunc{int
}{GetPriority
}{\void}
84 Gets the priority of the thread, between zero and
100.
86 The following priorities are already defined:
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}
95 \membersection{wxThread::IsAlive
}\label{wxthreadisalive
}
97 \constfunc{bool
}{IsAlive
}{\void}
99 Returns TRUE if the thread is alive.
101 \membersection{wxThread::IsMain
}\label{wxthreadismain
}
103 \constfunc{bool
}{IsMain
}{\void}
105 Returns TRUE if the calling thread is the main application thread.
107 \membersection{wxThread::Join
}\label{wxthreadjoin
}
109 \func{void*
}{Join
}{\void}
111 Waits for the termination of the thread. Returns a platform-specific exit code. TODO
113 \membersection{wxThread::OnExit
}\label{wxthreadonexit
}
115 \func{void
}{OnExit
}{\void}
117 Called when the thread exits. The default implementation calls
\helpref{wxThread::Join
}{wxthreadjoin
}.
119 \membersection{wxThread::SetPriority
}\label{wxthreadsetpriority
}
121 \func{void
}{SetPriority
}{\param{int
}{ priority
}}
123 Sets the priority of the thread, between zero and
100. This must be set before the thread is created.
125 The following priorities are already defined:
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}