summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibPthread/pthread_cond.cpp
AgeCommit message (Collapse)Author
2022-01-09LibPthread: Validate the clock argument in pthread_condattr_setclockBrian Gianforcaro
2022-01-09LibPthread: Implement pthread_condattr_getclockBrian Gianforcaro
I noticed this was missing while adding spec comments a bit ago. It's small and easy enough to implement, might as well make us more POSIX compliant.
2022-01-07LibPthread: Add POSIX spec links for pthread_cond APIBrian Gianforcaro
2021-11-24LibPthread: Initialize conditions with realtime clockJelle Raaijmakers
All the way back in commit 1670ee5aba09, the default clock for condition variables was set to `CLOCK_MONOTONIC`, because there was no other clock available. However, if a condition variable is initialized without any additional attributes by an application, they sometimes assume that the absolute time that is passed to e.g. `pthread_cond_timedwait` is actually based on a realtime clock, as can be seen here in SDL2: https://github.com/SerenityPorts/SDL/blob/6f419bdf5f56be236c070a9d364e0d238b868565/src/thread/pthread/SDL_syscond.c#L99 Additionally, the glibc implementation defaults to a realtime clock: https://github.com/bminor/glibc/blob/aac54dcd378209bbdddbcec749561b1d8f167d11/nptl/pthread_cond_init.c#L42 ...so we probably should do so as well :^)
2021-08-17Kernel+Userland: Remove global futexesAndreas Kling
We only ever use private futexes, so it doesn't make sense to carry around all the complexity required for global (cross-process) futexes.
2021-07-07LibC+LibPthread: Use FUTEX_PRIVATE_FLAG in more placesSergey Bugaev
Performance go brrrrr
2021-07-06LibPthread: Fix some assertionsSergey Bugaev
2021-07-06LibPthread: Fix orderingSergey Bugaev
It would be enough to use relaxed ordering here if it weren't for the mutex, which we also need to store and retrieve. To ensure the pthread_cond_broadcast() call sees the store, use release and acquire as appropriate. Thankfully, both of these are on the slow paths.
2021-07-05LibPthread: Reimplement condition variablesSergey Bugaev
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