summaryrefslogtreecommitdiff
path: root/eventflag.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-05-18 21:32:32 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-05-18 21:32:32 +0900
commit1b0fe5a6e8141a2c37770e67d24ec341b02b7fc3 (patch)
tree0b7cc39302b8969985811b3e7e8364ff76c5f5cf /eventflag.c
parent5e33e7f468eda8466da1dd55cacc88ee4915d18f (diff)
Add eventflag_set_poll_desc
Diffstat (limited to 'eventflag.c')
-rw-r--r--eventflag.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/eventflag.c b/eventflag.c
index 5fc5db5..c3e6f9a 100644
--- a/eventflag.c
+++ b/eventflag.c
@@ -66,6 +66,16 @@ eventflag_check (void *arg)
return ev->flags != 0;
}
+void
+eventflag_set_poll_desc (struct eventflag *ev, chopstx_poll_cond_t *poll_desc)
+{
+ poll_desc->type = CHOPSTX_POLL_COND;
+ poll_desc->ready = 0;
+ poll_desc->cond = &ev->cond;
+ poll_desc->mutex = &ev->mutex;
+ poll_desc->check = eventflag_check;
+ poll_desc->arg = ev;
+}
eventmask_t
eventflag_wait_timeout (struct eventflag *ev, uint32_t usec)
@@ -74,12 +84,7 @@ eventflag_wait_timeout (struct eventflag *ev, uint32_t usec)
int n;
eventmask_t em = 0;
- poll_desc.type = CHOPSTX_POLL_COND;
- poll_desc.ready = 0;
- poll_desc.cond = &ev->cond;
- poll_desc.mutex = &ev->mutex;
- poll_desc.check = eventflag_check;
- poll_desc.arg = ev;
+ eventflag_set_poll_desc (ev, &poll_desc);
chopstx_poll (&usec, 1, &poll_desc);