aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/thread.h')
-rw-r--r--core/include/thread.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/include/thread.h b/core/include/thread.h
index 7d346760..e82a80b2 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -46,6 +46,15 @@ struct semaphore {
struct thread_list list;
};
+#define DECLARE_INIT_SEMAPHORE(sem, cnt) \
+ struct semaphore sem = { \
+ .count = (cnt), \
+ .list = { \
+ .next = &sem.list, \
+ .prev = &sem.list \
+ } \
+ }
+
mstime_t sem_down(struct semaphore *, mstime_t);
void sem_up(struct semaphore *);
void sem_init(struct semaphore *, int);