mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-02 03:16:11 -04:00
Added sharedSynchronization library
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user