git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
regression: test serial port r/w.
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
ds
/
waitq.h
diff --git
a/lunaix-os/includes/lunaix/ds/waitq.h
b/lunaix-os/includes/lunaix/ds/waitq.h
index dfeb7c377893cdae489521b7c93f6cd8b7c23d29..219bf049d0340e96505cce52d715bb7befd50936 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/waitq.h
+++ b/
lunaix-os/includes/lunaix/ds/waitq.h
@@
-2,18
+2,25
@@
#define __LUNAIX_CODVAR_H
#include <lunaix/ds/llist.h>
#define __LUNAIX_CODVAR_H
#include <lunaix/ds/llist.h>
+#include <lunaix/sched.h>
typedef struct waitq
{
struct llist_header waiters;
} waitq_t;
typedef struct waitq
{
struct llist_header waiters;
} waitq_t;
-inline void
+
static
inline void
waitq_init(waitq_t* waitq)
{
llist_init_head(&waitq->waiters);
}
waitq_init(waitq_t* waitq)
{
llist_init_head(&waitq->waiters);
}
+static inline int
+waitq_empty(waitq_t* waitq)
+{
+ return llist_empty(&waitq->waiters);
+}
+
void
pwait(waitq_t* queue);
void
pwait(waitq_t* queue);
@@
-23,4
+30,9
@@
pwake_one(waitq_t* queue);
void
pwake_all(waitq_t* queue);
void
pwake_all(waitq_t* queue);
+#define wait_if(cond) \
+ while ((cond)) { \
+ sched_yieldk(); \
+ }
+
#endif /* __LUNAIX_CODVAR_H */
#endif /* __LUNAIX_CODVAR_H */