mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 18:46:03 +00:00
LibC: Rewrite pthread_mutex
pthread_mutex is now an actual "sleeping" mutex, and not just a spinlock! It still has a fast path that only uses atomics and (in the successful case) returns immediately without sleeping. In case of contention, it calls futex_wait(), which lets the kernel scheduler put this thread to sleep, *and* lets it know exactly when to consider scheduling it again.
This commit is contained in:
parent
8fee93d868
commit
19bef90923
Notes:
sideshowbarker
2024-07-18 10:21:39 +09:00
Author: https://github.com/bugaevc
Commit: 19bef90923
Pull-request: https://github.com/SerenityOS/serenity/pull/8455
Issue: https://github.com/SerenityOS/serenity/issues/8432
Reviewed-by: https://github.com/alimpfard
2 changed files with 83 additions and 51 deletions
|
@ -18,10 +18,10 @@ void __pthread_fork_atfork_register_prepare(void (*)(void));
|
|||
void __pthread_fork_atfork_register_parent(void (*)(void));
|
||||
void __pthread_fork_atfork_register_child(void (*)(void));
|
||||
|
||||
int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
|
||||
int __pthread_mutex_lock(pthread_mutex_t*);
|
||||
int __pthread_mutex_trylock(pthread_mutex_t*);
|
||||
int __pthread_mutex_unlock(pthread_mutex_t*);
|
||||
int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
|
||||
|
||||
typedef void (*KeyDestructor)(void*);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue