This class is a condition variable that can be placed in shared memory or memory mapped files. More...
#include <interprocess_condition.hpp>
Public Member Functions | |
interprocess_condition () | |
Constructs a interprocess_condition. On error throws interprocess_exception. More... | |
~interprocess_condition () | |
Destroys *this liberating system resources. More... | |
void | notify_one () |
If there is a thread waiting on *this, change that thread's state to ready. More... | |
void | notify_all () |
Change the state of all threads waiting on *this to ready. More... | |
template<typename L > | |
void | wait (L &lock) |
Releases the lock on the interprocess_mutex object associated with lock, blocks the current thread of execution until readied by a call to this->notify_one() or this->notify_all(), and then reacquires the lock. More... | |
template<typename L , typename Pr > | |
void | wait (L &lock, Pr pred) |
The same as: while (!pred()) wait(lock) More... | |
template<typename L > | |
bool | timed_wait (L &lock, const boost::posix_time::ptime &abs_time) |
Releases the lock on the interprocess_mutex object associated with lock, blocks the current thread of execution until readied by a call to this->notify_one() or this->notify_all(), or until time abs_time is reached, and then reacquires the lock. More... | |
template<typename L , typename Pr > | |
bool | timed_wait (L &lock, const boost::posix_time::ptime &abs_time, Pr pred) |
The same as: while (!pred()) { if (!timed_wait(lock, abs_time)) return pred(); } return true;. More... | |
Friends | |
class | named_condition |
This class is a condition variable that can be placed in shared memory or memory mapped files.
Destroys the object of type std::condition_variable_any
Unlike std::condition_variable in C++11, it is NOT safe to invoke the destructor if all threads have been only notified. It is required that they have exited their respective wait functions.
|
inline |
Constructs a interprocess_condition. On error throws interprocess_exception.
|
inline |
Destroys *this liberating system resources.
|
inline |
Change the state of all threads waiting on *this to ready.
If there are no waiting threads, notify_all() has no effect.
References boost::interprocess::ipcdetail::spin_condition::notify_all().
Referenced by boost::interprocess::ipcdetail::shm_named_condition::notify_all(), boost::interprocess::interprocess_upgradable_mutex::unlock(), boost::interprocess::interprocess_sharable_mutex::unlock(), boost::interprocess::interprocess_upgradable_mutex::unlock_and_lock_sharable(), boost::interprocess::interprocess_upgradable_mutex::unlock_and_lock_upgradable(), boost::interprocess::interprocess_upgradable_mutex::unlock_sharable(), boost::interprocess::interprocess_sharable_mutex::unlock_sharable(), boost::interprocess::interprocess_upgradable_mutex::unlock_upgradable(), and boost::interprocess::interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable().
|
inline |
If there is a thread waiting on *this, change that thread's state to ready.
Otherwise there is no effect.
References boost::interprocess::ipcdetail::spin_condition::notify_one().
Referenced by boost::interprocess::ipcdetail::shm_named_condition::notify_one(), boost::interprocess::interprocess_upgradable_mutex::unlock_sharable(), and boost::interprocess::interprocess_sharable_mutex::unlock_sharable().
|
inline |
Releases the lock on the interprocess_mutex object associated with lock, blocks the current thread of execution until readied by a call to this->notify_one() or this->notify_all(), or until time abs_time is reached, and then reacquires the lock.
Returns: false if time abs_time is reached, otherwise true.
References boost::interprocess::ipcdetail::spin_condition::timed_wait().
Referenced by boost::interprocess::interprocess_upgradable_mutex::timed_lock(), boost::interprocess::interprocess_sharable_mutex::timed_lock(), boost::interprocess::interprocess_upgradable_mutex::timed_lock_sharable(), boost::interprocess::interprocess_sharable_mutex::timed_lock_sharable(), boost::interprocess::interprocess_upgradable_mutex::timed_lock_upgradable(), and boost::interprocess::interprocess_upgradable_mutex::timed_unlock_upgradable_and_lock().
|
inline |
The same as: while (!pred()) { if (!timed_wait(lock, abs_time)) return pred(); } return true;.
References boost::interprocess::ipcdetail::spin_condition::timed_wait().
|
inline |
Releases the lock on the interprocess_mutex object associated with lock, blocks the current thread of execution until readied by a call to this->notify_one() or this->notify_all(), and then reacquires the lock.
References boost::interprocess::ipcdetail::spin_condition::wait().
Referenced by boost::interprocess::interprocess_upgradable_mutex::lock(), boost::interprocess::interprocess_sharable_mutex::lock(), boost::interprocess::interprocess_upgradable_mutex::lock_sharable(), boost::interprocess::interprocess_sharable_mutex::lock_sharable(), boost::interprocess::interprocess_upgradable_mutex::lock_upgradable(), boost::interprocess::interprocess_upgradable_mutex::unlock_upgradable_and_lock(), and boost::interprocess::ipcdetail::shm_named_condition::wait().
|
inline |
The same as: while (!pred()) wait(lock)
References boost::interprocess::ipcdetail::spin_condition::wait().
|
friend |