diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2021-07-05 14:41:41 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-05 20:26:01 +0200 |
commit | 19bef909233c3a64905d63db86f07b5fba4d3440 (patch) | |
tree | 3b2dba5e6797d50672ac2f5910fd45d67b97bef8 /Userland/Libraries/LibC/bits | |
parent | 8fee93d8680fe8408af552a74e00f5bc557e71a7 (diff) | |
download | serenity-19bef909233c3a64905d63db86f07b5fba4d3440.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibC/bits')
-rw-r--r-- | Userland/Libraries/LibC/bits/pthread_integration.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/bits/pthread_integration.h b/Userland/Libraries/LibC/bits/pthread_integration.h index 39af9e4d14..b74462afd2 100644 --- a/Userland/Libraries/LibC/bits/pthread_integration.h +++ b/Userland/Libraries/LibC/bits/pthread_integration.h @@ -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*); |