1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:47:44 +00:00

LibPthread: Implement pthread_condattr_getclock

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.
This commit is contained in:
Brian Gianforcaro 2022-01-08 19:56:52 -08:00 committed by Ali Mohammad Pur
parent 860d142c8c
commit 84962fcc9b
2 changed files with 8 additions and 0 deletions

View file

@ -90,6 +90,7 @@ int pthread_cond_init(pthread_cond_t*, const pthread_condattr_t*);
int pthread_cond_signal(pthread_cond_t*);
int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*);
int pthread_condattr_init(pthread_condattr_t*);
int pthread_condattr_getclock(pthread_condattr_t* attr, clockid_t* clock);
int pthread_condattr_setclock(pthread_condattr_t*, clockid_t);
int pthread_condattr_destroy(pthread_condattr_t*);
int pthread_cond_destroy(pthread_cond_t*);

View file

@ -29,6 +29,13 @@ int pthread_condattr_destroy(pthread_condattr_t*)
return 0;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_getclock.html
int pthread_condattr_getclock(pthread_condattr_t* attr, clockid_t* clock)
{
*clock = attr->clockid;
return 0;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_condattr_setclock.html
int pthread_condattr_setclock(pthread_condattr_t* attr, clockid_t clock)
{