]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/conditn.tex
a couple of wors about wxObjArray::Index()
[wxWidgets.git] / docs / latex / wx / conditn.tex
1 \section{\class{wxCondition}}\label{wxcondition}
2
3 wxCondition variables correspond to pthread conditions or to Win32 event
4 objects. They may be used in a multithreaded application to wait until the
5 given condition becomes true which happens when the condition becomes signaled.
6
7 For example, if a worker thread is doing some long task and another thread has
8 to wait until it's finished, the latter thread will wait on the condition
9 object and the worker thread will signal it on exit (this example is not
10 perfect because in this particular case it would be much better to just
11 \helpref{Wait()}{wxthreadwait} for the worker thread, but if there are several
12 worker threads it already makes much more sense).
13
14 \wxheading{Derived from}
15
16 None.
17
18 \wxheading{Include files}
19
20 <wx/thread.h>
21
22 \wxheading{See also}
23
24 \helpref{wxThread}{wxthread}, \helpref{wxMutex}{wxmutex}
25
26 \latexignore{\rtfignore{\wxheading{Members}}}
27
28 \membersection{wxCondition::wxCondition}\label{wxconditionconstr}
29
30 \func{}{wxCondition}{\void}
31
32 Default constructor.
33
34 \membersection{wxCondition::\destruct{wxCondition}}
35
36 \func{}{\destruct{wxCondition}}{\void}
37
38 Destroys the wxCondition object.
39
40 \membersection{wxCondition::Broadcast}\label{wxconditionbroadcast}
41
42 \func{void}{Broadcast}{\void}
43
44 Broadcasts to all waiting objects.
45
46 \membersection{wxCondition::Signal}\label{wxconditionsignal}
47
48 \func{void}{Signal}{\void}
49
50 Signals the object.
51
52 \membersection{wxCondition::Wait}\label{wxconditionwait}
53
54 \func{void}{Wait}{\param{wxMutex\&}{ mutex}}
55
56 Waits indefinitely.
57
58 \func{bool}{Wait}{\param{wxMutex\&}{ mutex}, \param{unsigned long}{ sec}, \param{unsigned long}{ nsec}}
59
60 Waits until a signal is raised or the timeout has elapsed.
61
62 \wxheading{Parameters}
63
64 \docparam{mutex}{wxMutex object.}
65
66 \docparam{sec}{Timeout in seconds}
67
68 \docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).}
69
70 \wxheading{Return value}
71
72 The second form returns if the signal was raised, or FALSE if there was a timeout.
73