1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibThreading: Fix building the library on macOS

This commit is contained in:
Gunnar Beutner 2021-07-06 00:06:32 +02:00
parent 565796ae4e
commit 01db5205ab
2 changed files with 14 additions and 1 deletions

View file

@ -14,14 +14,25 @@ namespace Threading {
class Lock {
public:
Lock() { }
Lock() {
#ifndef __serenity__
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&m_mutex, &attr);
#endif
}
~Lock() { }
void lock();
void unlock();
private:
#ifdef __serenity__
pthread_mutex_t m_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
#else
pthread_mutex_t m_mutex;
#endif
};
class Locker {