mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-01 02:15:54 -04:00
39 lines
753 B
C++
Executable File
39 lines
753 B
C++
Executable File
// ======================================================================
|
|
//
|
|
// ConditionVariable.cpp
|
|
// Acy Stapp
|
|
//
|
|
// Copyright 6/19/2001 Sony Online Entertainment
|
|
//
|
|
// ======================================================================
|
|
|
|
#include "sharedFoundation/FirstSharedFoundation.h"
|
|
#include "sharedSynchronization/ConditionVariable.h"
|
|
|
|
ConditionVariable::ConditionVariable(Mutex &m)
|
|
: _mutex(m)
|
|
{
|
|
pthread_cond_init(&cond, 0);
|
|
}
|
|
|
|
ConditionVariable::~ConditionVariable()
|
|
{
|
|
pthread_cond_destroy(&cond);
|
|
}
|
|
|
|
void ConditionVariable::wait()
|
|
{
|
|
pthread_cond_wait(&cond, &_mutex.getInternalMutex());
|
|
}
|
|
|
|
void ConditionVariable::signal()
|
|
{
|
|
pthread_cond_signal(&cond);
|
|
}
|
|
|
|
void ConditionVariable::broadcast()
|
|
{
|
|
pthread_cond_broadcast(&cond);
|
|
}
|
|
|