File condition_variable.hpp

namespace shared_memory

All templated types in this namespaces are elementary types: int, double, float, char*, …

Typedefs

typedef boost::interprocess::named_condition SHMCondition
class ConditionVariable

Public Functions

ConditionVariable(const std::string object_id, bool clean_memory_on_destruction)

A condition variable shared over the memory The condition variable is cleaned from the memory on destruction if clean_memory_on_destruction is set to true.

~ConditionVariable()
void notify_all()

notify_all is notifying all condition variables with the same mutex

void notify_one()

notify_one notifies one condition variable with the same mutex

bool timed_wait(Lock &lock, long wait_nano_seconds)

timed_wait wait a notify during a certain certain time and then wake up

Parameters:

wait_duration – in microsecond

Returns:

true: the condition variable has been notified, false otherwize

void wait(Lock &lock)

wait waits until another thread notifies this object

Public Static Functions

static void clean(const std::string object_id)

Private Members

std::string condition_id_

condition_id_ is the condition variable name in the shared memory

bool clean_memory_on_destruction_

if true (the default), clean the shared memory of the hosted mutex and condition.

SHMCondition *condition_variable_

condition_variable_ is the boost condition variable that is used

std::string mutex_id_

mutex_id_ is the mutex name in the shared memory