summaryrefslogtreecommitdiffstats
path: root/cmd-wait-for.c
diff options
context:
space:
mode:
authornicm <nicm>2015-09-13 10:45:55 +0000
committernicm <nicm>2015-09-13 10:45:55 +0000
commitede0f2f633c2a0c2718004f0527bd5832041e966 (patch)
tree0013ef6dcb19c3296fe718941aadc4e0c294efa4 /cmd-wait-for.c
parenta3de5dbab1680528d622a5054075e3d8efced795 (diff)
Set woken flag when flushing so that the channel is freed, while here
use the same loop construct for both loops.
Diffstat (limited to 'cmd-wait-for.c')
-rw-r--r--cmd-wait-for.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-wait-for.c b/cmd-wait-for.c
index 0dce438b..e38ea8f1 100644
--- a/cmd-wait-for.c
+++ b/cmd-wait-for.c
@@ -97,7 +97,6 @@ cmd_wait_for_add(const char *name)
void
cmd_wait_for_remove(struct wait_channel *wc)
{
-
if (wc->locked)
return;
if (!TAILQ_EMPTY(&wc->waiters) || !wc->woken)
@@ -241,7 +240,8 @@ cmd_wait_for_flush(void)
if (!cmdq_free(wq))
cmdq_continue(wq);
}
- while ((wq = TAILQ_FIRST(&wc->lockers)) != NULL) {
+ wc->woken = 1;
+ TAILQ_FOREACH_SAFE(wq, &wc->lockers, waitentry, wq1) {
TAILQ_REMOVE(&wc->lockers, wq, waitentry);
if (!cmdq_free(wq))
cmdq_continue(wq);