2012-04-02 08:56:30 +02:00
|
|
|
#ifndef CONDVAR_H
|
|
|
|
#define CONDVAR_H
|
2012-03-31 09:09:40 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-04-22 16:45:31 +02:00
|
|
|
/**
|
|
|
|
* CondVar
|
|
|
|
*
|
|
|
|
* A wrapper around OS-specific condition variable functionality.
|
|
|
|
*/
|
2012-04-16 08:36:50 +02:00
|
|
|
class I2_BASE_API CondVar
|
2012-03-31 09:09:40 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
#ifdef _WIN32
|
|
|
|
CONDITION_VARIABLE m_CondVar;
|
|
|
|
#else /* _WIN32 */
|
|
|
|
pthread_cond_t m_CondVar;
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
public:
|
2012-04-16 08:36:50 +02:00
|
|
|
CondVar(void);
|
|
|
|
~CondVar(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
|
2012-04-16 08:36:50 +02:00
|
|
|
void Wait(Mutex& mtx);
|
|
|
|
void Signal(void);
|
|
|
|
void Broadcast(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2012-04-16 08:36:50 +02:00
|
|
|
CONDITION_VARIABLE *Get(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
#else /* _WIN32 */
|
2012-04-16 08:36:50 +02:00
|
|
|
pthread_cond_t *Get(void);
|
2012-03-31 09:09:40 +02:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-04-02 08:56:30 +02:00
|
|
|
#endif /* CONDVAR_H */
|