diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 47cbea7eb5..b64b1d91af 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -108,6 +108,8 @@ include_directories(../../Userland/) include_directories(../../Userland/Libraries/) include_directories(${CMAKE_BINARY_DIR}) add_library(LagomCore ${LAGOM_CORE_SOURCES}) +find_package(Threads REQUIRED) +target_link_libraries(LagomCore PRIVATE Threads::Threads) if (BUILD_LAGOM) add_library(Lagom $ ${LAGOM_MORE_SOURCES}) diff --git a/Userland/Libraries/LibThreading/Lock.h b/Userland/Libraries/LibThreading/Lock.h index a0613c1800..57ed4cae8e 100644 --- a/Userland/Libraries/LibThreading/Lock.h +++ b/Userland/Libraries/LibThreading/Lock.h @@ -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 {