]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/conditn.tex
new wxHtmlWindow::OnOpeningURL API
[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 is 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 Once the thread(s) are signaled, the condition then resets to the not
15 signaled state, ready to fire again.
16
17 \wxheading{Derived from}
18
19 None.
20
21 \wxheading{Include files}
22
23 <wx/thread.h>
24
25 \wxheading{See also}
26
27 \helpref{wxThread}{wxthread}, \helpref{wxMutex}{wxmutex}
28
29 \latexignore{\rtfignore{\wxheading{Members}}}
30
31 \membersection{wxCondition::wxCondition}\label{wxconditionconstr}
32
33 \func{}{wxCondition}{\void}
34
35 Default constructor.
36
37 \membersection{wxCondition::\destruct{wxCondition}}
38
39 \func{}{\destruct{wxCondition}}{\void}
40
41 Destroys the wxCondition object.
42
43 \membersection{wxCondition::Broadcast}\label{wxconditionbroadcast}
44
45 \func{void}{Broadcast}{\void}
46
47 Broadcasts to all waiting objects.
48
49 \membersection{wxCondition::Signal}\label{wxconditionsignal}
50
51 \func{void}{Signal}{\void}
52
53 Signals the object.
54
55 \membersection{wxCondition::Wait}\label{wxconditionwait}
56
57 \func{void}{Wait}{\void}
58
59 Waits indefinitely.
60
61 \func{bool}{Wait}{\param{unsigned long}{ sec}, \param{unsigned long}{ nsec}}
62
63 Waits until a signal is raised or the timeout has elapsed.
64
65 \wxheading{Parameters}
66
67 \docparam{sec}{Timeout in seconds}
68
69 \docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).}
70
71 \wxheading{Return value}
72
73 The second form returns if the signal was raised, or FALSE if there was a timeout.
74