LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
Public Types | Public Member Functions | List of all members
osl::Condition Class Reference

Condition variable. More...

#include <conditn.hxx>

Public Types

enum  Result { result_ok = osl_cond_result_ok, result_error = osl_cond_result_error, result_timeout = osl_cond_result_timeout }
 

Public Member Functions

 Condition ()
 Create a condition. More...
 
 ~Condition ()
 Release the OS-structures and free condition data-structure. More...
 
void set ()
 Release all waiting threads, check returns true. More...
 
void reset ()
 Reset condition to false: wait() will block, check() returns false. More...
 
Result wait (const TimeValue *pTimeout=NULL)
 Blocks the calling thread until condition is set. More...
 
bool check ()
 Checks if the condition is set without blocking. More...
 

Detailed Description

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

Member Enumeration Documentation

◆ Result

Enumerator
result_ok 

Successful completion.

result_error 

Error occurred.

See also
osl_getLastSocketError()
result_timeout 

Blocking operation timed out.

Constructor & Destructor Documentation

◆ 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.

Member Function Documentation

◆ check()

bool osl::Condition::check ( )
inline

Checks if the condition is set without blocking.

Return values
truecondition is set
falsecondition 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()

Result osl::Condition::wait ( const TimeValue pTimeout = NULL)
inline

Blocks the calling thread until condition is set.

Parameters
[in]pTimeoutTimeout to wait before ending the condition. Defaults to NULL
Return values
result_okfinished successfully
result_errorerror occurred
result_timeouttimed 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: