From a12c2df43f95b5dfbaa3c241845e5e62515c65fc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 22 Dec 2019 20:25:09 +0100 Subject: [PATCH] LibPthread: Okay I'm dumb, let's convert mutex locks into Atomic& --- Libraries/LibPthread/pthread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibPthread/pthread.cpp b/Libraries/LibPthread/pthread.cpp index fdf5cfbcfe3..1d8b8676838 100644 --- a/Libraries/LibPthread/pthread.cpp +++ b/Libraries/LibPthread/pthread.cpp @@ -114,11 +114,11 @@ int pthread_mutex_destroy(pthread_mutex_t*) int pthread_mutex_lock(pthread_mutex_t* mutex) { - auto* atomic = reinterpret_cast*>(mutex->lock); + auto& atomic = reinterpret_cast&>(mutex->lock); pthread_t this_thread = pthread_self(); for (;;) { u32 expected = false; - if (!atomic->compare_exchange_strong(expected, true, AK::memory_order_acq_rel)) { + if (!atomic.compare_exchange_strong(expected, true, AK::memory_order_acq_rel)) { if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->owner == this_thread) { mutex->level++; return 0; @@ -134,9 +134,9 @@ int pthread_mutex_lock(pthread_mutex_t* mutex) int pthread_mutex_trylock(pthread_mutex_t* mutex) { - auto* atomic = reinterpret_cast*>(mutex->lock); + auto& atomic = reinterpret_cast&>(mutex->lock); u32 expected = false; - if (!atomic->compare_exchange_strong(expected, true, AK::memory_order_acq_rel)) { + if (!atomic.compare_exchange_strong(expected, true, AK::memory_order_acq_rel)) { if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->owner == pthread_self()) { mutex->level++; return 0;