mirror of
https://github.com/anope/anope.git
synced 2026-06-25 15:26:39 +02:00
Replace Condition and Mutex with the C++11 standard equivalents.
This commit is contained in:
@@ -81,48 +81,3 @@ void Thread::OnNotify()
|
||||
this->Join();
|
||||
this->flags[SF_DEAD] = true;
|
||||
}
|
||||
|
||||
Mutex::Mutex()
|
||||
{
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
}
|
||||
|
||||
Mutex::~Mutex()
|
||||
{
|
||||
pthread_mutex_destroy(&mutex);
|
||||
}
|
||||
|
||||
void Mutex::Lock()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
void Mutex::Unlock()
|
||||
{
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
bool Mutex::TryLock()
|
||||
{
|
||||
return pthread_mutex_trylock(&mutex) == 0;
|
||||
}
|
||||
|
||||
Condition::Condition() : Mutex()
|
||||
{
|
||||
pthread_cond_init(&cond, NULL);
|
||||
}
|
||||
|
||||
Condition::~Condition()
|
||||
{
|
||||
pthread_cond_destroy(&cond);
|
||||
}
|
||||
|
||||
void Condition::Wakeup()
|
||||
{
|
||||
pthread_cond_signal(&cond);
|
||||
}
|
||||
|
||||
void Condition::Wait()
|
||||
{
|
||||
pthread_cond_wait(&cond, &mutex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user