Merge branch 'device-sys'
[lunaix-os.git] / lunaix-os / includes / lunaix / ds / waitq.h
1 #ifndef __LUNAIX_CODVAR_H
2 #define __LUNAIX_CODVAR_H
3
4 #include <lunaix/ds/llist.h>
5
6 typedef struct waitq
7 {
8     struct llist_header waiters;
9 } waitq_t;
10
11 static inline void
12 waitq_init(waitq_t* waitq)
13 {
14     llist_init_head(&waitq->waiters);
15 }
16
17 static inline int
18 waitq_empty(waitq_t* waitq)
19 {
20     return llist_empty(&waitq->waiters);
21 }
22
23 void
24 pwait(waitq_t* queue);
25
26 void
27 pwake_one(waitq_t* queue);
28
29 void
30 pwake_all(waitq_t* queue);
31
32 #endif /* __LUNAIX_CODVAR_H */