Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::interprocess::interprocess_condition_any Class Reference

This class is a condition variable that can be placed in shared memory or memory mapped files. More...

#include <interprocess_condition_any.hpp>

Public Member Functions

 interprocess_condition_any ()
 Constructs a interprocess_condition_any. On error throws interprocess_exception. More...
 
 ~interprocess_condition_any ()
 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...
 

Detailed Description

This class is a condition variable that can be placed in shared memory or memory mapped files.

The interprocess_condition_any class is a generalization of interprocess_condition. Whereas interprocess_condition works only on Locks with mutex_type == interprocess_mutex interprocess_condition_any can operate on any user-defined lock that meets the BasicLockable requirements (lock()/unlock() member functions).

Unlike std::condition_variable_any 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.

Constructor & Destructor Documentation

boost::interprocess::interprocess_condition_any::interprocess_condition_any ( )
inline

Constructs a interprocess_condition_any. On error throws interprocess_exception.

boost::interprocess::interprocess_condition_any::~interprocess_condition_any ( )
inline

Destroys *this liberating system resources.

Member Function Documentation

void boost::interprocess::interprocess_condition_any::notify_all ( )
inline

Change the state of all threads waiting on *this to ready.

If there are no waiting threads, notify_all() has no effect.

void boost::interprocess::interprocess_condition_any::notify_one ( )
inline

If there is a thread waiting on *this, change that thread's state to ready.

Otherwise there is no effect.

template<typename L >
bool boost::interprocess::interprocess_condition_any::timed_wait ( L &  lock,
const boost::posix_time::ptime abs_time 
)
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.

template<typename L , typename Pr >
bool boost::interprocess::interprocess_condition_any::timed_wait ( L &  lock,
const boost::posix_time::ptime abs_time,
Pr  pred 
)
inline

The same as: while (!pred()) { if (!timed_wait(lock, abs_time)) return pred(); } return true;.

template<typename L >
void boost::interprocess::interprocess_condition_any::wait ( L &  lock)
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.

template<typename L , typename Pr >
void boost::interprocess::interprocess_condition_any::wait ( L &  lock,
Pr  pred 
)
inline

The same as: while (!pred()) wait(lock)


The documentation for this class was generated from the following file: