diff --git a/include/sys/threads.h b/include/sys/threads.h index a03b62d0..04d47197 100644 --- a/include/sys/threads.h +++ b/include/sys/threads.h @@ -22,7 +22,7 @@ #include #include #include - +#include #ifdef __cplusplus extern "C" { @@ -128,9 +128,18 @@ extern int semaphoreUp(semaphore_t *s); extern int semaphoreDone(semaphore_t *s); +extern int phCondCreate(handle_t *h, const struct condAttr *attr); + + extern int condCreate(handle_t *h); +static inline int condCreateWithAttr(handle_t *h, const struct condAttr *attr) +{ + return phCondCreate(h, attr); +} + + extern int condWait(handle_t h, handle_t m, time_t timeout); diff --git a/sys/threads.c b/sys/threads.c index 2c083edd..ce7e5824 100644 --- a/sys/threads.c +++ b/sys/threads.c @@ -33,6 +33,14 @@ int mutexLock(handle_t m) } +int condCreate(handle_t *h) +{ + static const struct condAttr defaultAttr = { .clock = PH_CLOCK_RELATIVE }; + + return phCondCreate(h, &defaultAttr); +} + + int condWait(handle_t h, handle_t m, time_t timeout) { int err, mut_err;