1998-06-14 08:11:50 -04:00
|
|
|
\section{\class{wxCondition}}\label{wxcondition}
|
|
|
|
|
1999-11-27 18:15:07 -05:00
|
|
|
wxCondition variables correspond to pthread conditions or to Win32 event
|
|
|
|
objects. They may be used in a multithreaded application to wait until the
|
|
|
|
given condition becomes true which happens when the condition becomes signaled.
|
|
|
|
|
|
|
|
For example, if a worker thread is doing some long task and another thread has
|
2000-07-15 15:51:35 -04:00
|
|
|
to wait until it is finished, the latter thread will wait on the condition
|
1999-11-27 18:15:07 -05:00
|
|
|
object and the worker thread will signal it on exit (this example is not
|
|
|
|
perfect because in this particular case it would be much better to just
|
|
|
|
\helpref{Wait()}{wxthreadwait} for the worker thread, but if there are several
|
|
|
|
worker threads it already makes much more sense).
|
1998-06-14 08:11:50 -04:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
Once the thread(s) are signaled, the condition then resets to the not
|
|
|
|
signaled state, ready to fire again.
|
|
|
|
|
1998-06-14 08:11:50 -04:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/thread.h>
|
|
|
|
|
1998-06-14 08:11:50 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxThread}{wxthread}, \helpref{wxMutex}{wxmutex}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
\membersection{wxCondition::wxCondition}\label{wxconditionconstr}
|
|
|
|
|
|
|
|
\func{}{wxCondition}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
\membersection{wxCondition::\destruct{wxCondition}}
|
|
|
|
|
|
|
|
\func{}{\destruct{wxCondition}}{\void}
|
|
|
|
|
|
|
|
Destroys the wxCondition object.
|
|
|
|
|
|
|
|
\membersection{wxCondition::Broadcast}\label{wxconditionbroadcast}
|
|
|
|
|
|
|
|
\func{void}{Broadcast}{\void}
|
|
|
|
|
|
|
|
Broadcasts to all waiting objects.
|
|
|
|
|
|
|
|
\membersection{wxCondition::Signal}\label{wxconditionsignal}
|
|
|
|
|
|
|
|
\func{void}{Signal}{\void}
|
|
|
|
|
|
|
|
Signals the object.
|
|
|
|
|
|
|
|
\membersection{wxCondition::Wait}\label{wxconditionwait}
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
\func{void}{Wait}{\void}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
Waits indefinitely.
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
\func{bool}{Wait}{\param{unsigned long}{ sec}, \param{unsigned long}{ nsec}}
|
1998-06-14 08:11:50 -04:00
|
|
|
|
|
|
|
Waits until a signal is raised or the timeout has elapsed.
|
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{sec}{Timeout in seconds}
|
|
|
|
|
|
|
|
\docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).}
|
|
|
|
|
|
|
|
\wxheading{Return value}
|
|
|
|
|
|
|
|
The second form returns if the signal was raised, or FALSE if there was a timeout.
|
|
|
|
|