Skip to content

Commit

Permalink
sys/threads: add function to create cond with attributes
Browse files Browse the repository at this point in the history
JIRA: RTOS-870
  • Loading branch information
lukileczo committed Jul 19, 2024
1 parent e52e00f commit 69d4a70
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/sys/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <phoenix/sysinfo.h>
#include <phoenix/signal.h>
#include <phoenix/threads.h>

#include <phoenix/time.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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);


Expand Down
8 changes: 8 additions & 0 deletions sys/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 69d4a70

Please sign in to comment.