1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 06:24:58 +00:00

LibC: Fix passing futex value for FUTEX_WAKE_BITSET

FUTEX_WAKE_BITSET, like FUTEX_WAKE, accepts the number of waiting
threads to wake, not the current value of the futex. Pass UINT32_MAX
instead.
This commit is contained in:
Sergey Bugaev 2023-08-13 16:29:04 +03:00 committed by Andrew Kaster
parent f660fc97a9
commit 0a6690b745

View file

@ -852,7 +852,7 @@ int pthread_rwlock_unlock(pthread_rwlock_t* lockval_p)
auto desired = current & ~(writer_locked_mask | writer_intent_mask);
AK::atomic_store(lockp, desired, AK::MemoryOrder::memory_order_release);
// Then wake both readers and writers, if any.
auto rc = futex(lockp, FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG, current, nullptr, nullptr, (current & writer_wake_mask) | reader_wake_mask);
auto rc = futex(lockp, FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG, UINT32_MAX, nullptr, nullptr, (current & writer_wake_mask) | reader_wake_mask);
if (rc < 0)
return errno;
return 0;