summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-02 09:09:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-02 18:09:32 +0200
commit9e3fb73169994b221be6bde58d323f8d101cb12c (patch)
tree623c89ec83c9e3e7088e44409b7859588a74f9af /Userland/Libraries/LibC
parent90f4c9e44c10bd6035050daefaa2aa6fa3e683e1 (diff)
downloadserenity-9e3fb73169994b221be6bde58d323f8d101cb12c.zip
LibC: Use memory_order_acquire instead of memory_order_acq_rel
Acquire ordering should be sufficient for pthread_mutex_lock and pthread_mutex_trylock.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/pthread_integration.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/pthread_integration.cpp b/Userland/Libraries/LibC/pthread_integration.cpp
index f0ef135b25..ee26265cf5 100644
--- a/Userland/Libraries/LibC/pthread_integration.cpp
+++ b/Userland/Libraries/LibC/pthread_integration.cpp
@@ -96,7 +96,7 @@ int __pthread_mutex_lock(pthread_mutex_t* mutex)
pthread_t this_thread = __pthread_self();
for (;;) {
u32 expected = 0;
- if (!AK::atomic_compare_exchange_strong(&mutex->lock, expected, 1u, AK::memory_order_acq_rel)) {
+ if (!AK::atomic_compare_exchange_strong(&mutex->lock, expected, 1u, AK::memory_order_acquire)) {
if (mutex->type == __PTHREAD_MUTEX_RECURSIVE && mutex->owner == this_thread) {
mutex->level++;
return 0;
@@ -128,7 +128,7 @@ int pthread_mutex_unlock(pthread_mutex_t*) __attribute__((weak, alias("__pthread
int __pthread_mutex_trylock(pthread_mutex_t* mutex)
{
u32 expected = 0;
- if (!AK::atomic_compare_exchange_strong(&mutex->lock, expected, 1u, AK::memory_order_acq_rel)) {
+ if (!AK::atomic_compare_exchange_strong(&mutex->lock, expected, 1u, AK::memory_order_acquire)) {
if (mutex->type == __PTHREAD_MUTEX_RECURSIVE && mutex->owner == pthread_self()) {
mutex->level++;
return 0;