You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#ifndef CONDITION_VARIABLE_HPP
|
|
|
|
#define CONDITION_VARIABLE_HPP
|
|
|
|
|
|
|
|
#include "Mutex.hpp"
|
|
|
|
#include <pthread.h> // pthread_cond
|
|
|
|
|
|
|
|
class ConditionVariable
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConditionVariable(const Mutex* const mutex);
|
|
|
|
~ConditionVariable();
|
|
|
|
|
|
|
|
void wait(const int interval = 0);
|
|
|
|
void signal();
|
|
|
|
void broadcast();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
ConditionVariable(const ConditionVariable&);
|
|
|
|
ConditionVariable& operator=(const ConditionVariable&);
|
|
|
|
|
|
|
|
const Mutex* const m_mutex;
|
|
|
|
pthread_cond_t m_condVar;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONDITION_VARIABLE_HPP
|