1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

LibPthread: Reimplement condition variables

This implementation features a fast path for pthread_cond_signal() and
pthread_cond_broadcast() for the case there's no thread waiting, and
does not exhibit the "thundering herd" issue in
pthread_cond_broadcast().

Fixes https://github.com/SerenityOS/serenity/issues/8432
This commit is contained in:
Sergey Bugaev 2021-07-05 15:06:54 +03:00 committed by Andreas Kling
parent 5536f3c277
commit 00d8dbe739
4 changed files with 135 additions and 73 deletions

View file

@ -75,8 +75,8 @@ typedef struct __pthread_mutexattr_t {
} pthread_mutexattr_t;
typedef struct __pthread_cond_t {
pthread_mutex_t* mutex;
uint32_t value;
uint32_t previous;
int clockid; // clockid_t
} pthread_cond_t;