From 9943816e83fc5e4818fa97ac95bca821b7ed13ef Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 21 Jan 2021 14:43:07 -0700 Subject: [PATCH] LibPthread: Fix asserting futex return value FUTEX_WAIT returns the number of threads woken (if any). Fixes #5032 --- Userland/Libraries/LibPthread/pthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPthread/pthread.cpp b/Userland/Libraries/LibPthread/pthread.cpp index 9a0b8ab65a5..455d05cfb5e 100644 --- a/Userland/Libraries/LibPthread/pthread.cpp +++ b/Userland/Libraries/LibPthread/pthread.cpp @@ -552,7 +552,7 @@ int pthread_cond_signal(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, 1, nullptr, nullptr, 0); - ASSERT(rc == 0); + ASSERT(rc >= 0); return 0; } @@ -561,7 +561,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond) u32 value = cond->previous + 1; cond->value = value; int rc = futex(&cond->value, FUTEX_WAKE, INT32_MAX, nullptr, nullptr, 0); - ASSERT(rc == 0); + ASSERT(rc >= 0); return 0; }