summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2022-01-07 00:34:33 -0800
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-07 01:18:57 -0800
commit800f14298d23fdf91193a6f312ee92cd61fc1cb1 (patch)
treea905f84b2e733a28285fef3e7f211935f5865b05
parent54e15821cdfb68662f39a56e21da904958c1fff0 (diff)
downloadserenity-800f14298d23fdf91193a6f312ee92cd61fc1cb1.zip
LibPthread: Add POSIX spec links for pthread_cond API
-rw-r--r--Userland/Libraries/LibPthread/pthread_cond.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibPthread/pthread_cond.cpp b/Userland/Libraries/LibPthread/pthread_cond.cpp
index 41f1c842a1..f46aeeed0d 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.