Avoid race to wake up napping processes
This commit is contained in:
parent
e0ca281c32
commit
fa222940fc
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue