Condition variable.
More...
#include <conditn.hxx>
Condition variable.
A condition variable is essentially an object that is initially cleared which a thread waits on until it is "set". It allows a thread to synchronize execution by allowing other threads to wait for the condition to change before that thread then continues execution.
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
- Attention
- Warning: the Condition abstraction is inadequate for any situation where there may be multiple threads setting, waiting, and resetting the same condition. It can only be used to synchronise interactions between two threads cf. lost wakeups in http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
◆ Result
Enumerator |
---|
result_ok | Successful completion.
|
result_error | Error occurred. - See also
- osl_getLastSocketError()
|
result_timeout | Blocking operation timed out.
|
◆ Condition()
osl::Condition::Condition |
( |
| ) |
|
|
inline |
Create a condition.
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
◆ ~Condition()
osl::Condition::~Condition |
( |
| ) |
|
|
inline |
Release the OS-structures and free condition data-structure.
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
◆ check()
bool osl::Condition::check |
( |
| ) |
|
|
inline |
Checks if the condition is set without blocking.
- Return values
-
true | condition is set |
false | condition is not set |
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
◆ reset()
void osl::Condition::reset |
( |
| ) |
|
|
inline |
Reset condition to false: wait() will block, check() returns false.
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
◆ set()
void osl::Condition::set |
( |
| ) |
|
|
inline |
Release all waiting threads, check returns true.
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
◆ wait()
Blocks the calling thread until condition is set.
- Parameters
-
[in] | pTimeout | Timeout to wait before ending the condition. Defaults to NULL |
- Return values
-
result_ok | finished successfully |
result_error | error occurred |
result_timeout | timed out |
- Deprecated:
- use C++11's std::condition_variable instead for a more robust and helpful condition.
The documentation for this class was generated from the following file: