]>
Commit | Line | Data |
---|---|---|
eaaa6a06 JS |
1 | \section{\class{wxCondition}}\label{wxcondition} |
2 | ||
9063ea8e VZ |
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 | |
f6bcfd97 | 8 | to wait until it is finished, the latter thread will wait on the condition |
9063ea8e VZ |
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). | |
eaaa6a06 | 13 | |
f6bcfd97 BP |
14 | Once the thread(s) are signaled, the condition then resets to the not |
15 | signaled state, ready to fire again. | |
16 | ||
eaaa6a06 JS |
17 | \wxheading{Derived from} |
18 | ||
19 | None. | |
20 | ||
954b8ae6 JS |
21 | \wxheading{Include files} |
22 | ||
23 | <wx/thread.h> | |
24 | ||
eaaa6a06 JS |
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 | ||
f6bcfd97 | 57 | \func{void}{Wait}{\void} |
eaaa6a06 JS |
58 | |
59 | Waits indefinitely. | |
60 | ||
f6bcfd97 | 61 | \func{bool}{Wait}{\param{unsigned long}{ sec}, \param{unsigned long}{ nsec}} |
eaaa6a06 JS |
62 | |
63 | Waits until a signal is raised or the timeout has elapsed. | |
64 | ||
65 | \wxheading{Parameters} | |
66 | ||
eaaa6a06 JS |
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 |