1
0
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:
Sadie Powell
2024-02-11 19:53:05 +00:00
parent 5c50bcb9c7
commit 2c5b84bd1d
4 changed files with 59 additions and 149 deletions
-45
View File
@@ -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);
}