From fa222940fccc38a3f0522424389157a59dbd73dc Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 10 Jan 2011 14:44:47 -0500 Subject: [PATCH] Avoid race to wake up napping processes --- server/harness.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/harness.c b/server/harness.c index 5e41527..ea222b7 100644 --- a/server/harness.c +++ b/server/harness.c @@ -125,9 +125,10 @@ typedef struct nap_context_t_ { void nap_isr(int fd, short what, void *arg) { nap_context_t *context = arg; //info("nap_isr %p\n", p); - assert((context->p->state == PROCESS_WAITING) && (context->p->wait_flags & EV_TIMEOUT)); - context->timeout_fired = 1; - enqueue_runlist(context->p); + if ((context->p->state == PROCESS_WAITING) && (context->p->wait_flags & EV_TIMEOUT)) { + context->timeout_fired = 1; + enqueue_runlist(context->p); + } } int nap(long millis) {