From 800f14298d23fdf91193a6f312ee92cd61fc1cb1 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Fri, 7 Jan 2022 00:34:33 -0800 Subject: [PATCH] LibPthread: Add POSIX spec links for pthread_cond API --- Userland/Libraries/LibPthread/pthread_cond.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Userland/Libraries/LibPthread/pthread_cond.cpp b/Userland/Libraries/LibPthread/pthread_cond.cpp index 41f1c842a17..f46aeeed0df 100644 --- a/Userland/Libraries/LibPthread/pthread_cond.cpp +++ b/Userland/Libraries/LibPthread/pthread_cond.cpp @@ -16,17 +16,20 @@ // Condition variable attributes. +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_init.html int pthread_condattr_init(pthread_condattr_t* attr) { attr->clockid = CLOCK_MONOTONIC_COARSE; return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_destroy.html int pthread_condattr_destroy(pthread_condattr_t*) { return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_setclock.html int pthread_condattr_setclock(pthread_condattr_t* attr, clockid_t clock) { attr->clockid = clock; @@ -44,6 +47,7 @@ static constexpr u32 NEED_TO_WAKE_ONE = 1; static constexpr u32 NEED_TO_WAKE_ALL = 2; static constexpr u32 INCREMENT = 4; +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_init.html int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr) { cond->mutex = nullptr; @@ -52,16 +56,19 @@ int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr) return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_destroy.html int pthread_cond_destroy(pthread_cond_t*) { return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_wait.html int pthread_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex) { return pthread_cond_timedwait(cond, mutex, nullptr); } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html int pthread_cond_timedwait(pthread_cond_t* cond, pthread_mutex_t* mutex, const struct timespec* abstime) { // Save the mutex this condition variable is associated with. We don't (yet) @@ -85,6 +92,7 @@ int pthread_cond_timedwait(pthread_cond_t* cond, pthread_mutex_t* mutex, const s return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_signal.html int pthread_cond_signal(pthread_cond_t* cond) { // Increment the generation. @@ -114,6 +122,7 @@ int pthread_cond_signal(pthread_cond_t* cond) return 0; } +// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html int pthread_cond_broadcast(pthread_cond_t* cond) { // Increment the generation.