diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-07-14 01:25:35 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-21 16:39:22 +0200 |
commit | 9db10887a1499db41c1c549cf60a9c0ba27766c0 (patch) | |
tree | c042c39333ef100280a633e7dcb85fe4bd2a76cb /Userland/Libraries/LibC/pthread_cond.cpp | |
parent | 55c7496200a321226b3599c24cfd40e899df73b0 (diff) | |
download | serenity-9db10887a1499db41c1c549cf60a9c0ba27766c0.zip |
Kernel: Clean up sys$futex and add support for cross-process futexes
Diffstat (limited to 'Userland/Libraries/LibC/pthread_cond.cpp')
-rw-r--r-- | Userland/Libraries/LibC/pthread_cond.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibC/pthread_cond.cpp b/Userland/Libraries/LibC/pthread_cond.cpp index 5ba15c368e..0ff377bfac 100644 --- a/Userland/Libraries/LibC/pthread_cond.cpp +++ b/Userland/Libraries/LibC/pthread_cond.cpp @@ -98,7 +98,7 @@ int pthread_cond_timedwait(pthread_cond_t* cond, pthread_mutex_t* mutex, const s // value might change as soon as we unlock it. u32 value = AK::atomic_fetch_or(&cond->value, NEED_TO_WAKE_ONE | NEED_TO_WAKE_ALL, AK::memory_order_release) | NEED_TO_WAKE_ONE | NEED_TO_WAKE_ALL; pthread_mutex_unlock(mutex); - int rc = futex_wait(&cond->value, value, abstime, cond->clockid); + int rc = futex_wait(&cond->value, value, abstime, cond->clockid, false); if (rc < 0 && errno != EAGAIN) return errno; @@ -129,7 +129,7 @@ int pthread_cond_signal(pthread_cond_t* cond) if (!(value & NEED_TO_WAKE_ONE)) [[likely]] return 0; // ...try to wake someone... - int rc = futex_wake(&cond->value, 1); + int rc = futex_wake(&cond->value, 1, false); VERIFY(rc >= 0); // ...and if we have woken someone, put the flag back. if (rc > 0) @@ -152,7 +152,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond) pthread_mutex_t* mutex = AK::atomic_load(&cond->mutex, AK::memory_order_relaxed); VERIFY(mutex); - int rc = futex(&cond->value, FUTEX_REQUEUE, 1, nullptr, &mutex->lock, INT_MAX); + int rc = futex(&cond->value, FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG, 1, nullptr, &mutex->lock, INT_MAX); VERIFY(rc >= 0); return 0; } |