From: Ben Gras Date: Thu, 11 Dec 2008 13:42:37 +0000 (+0000) Subject: fix race condition that can trigger 'enqueue already ready process' panic. X-Git-Tag: v3.1.4~217 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-keyfromlabel.html?a=commitdiff_plain;h=a74132ec694aba570dd1d7cc6f31b33977571967;p=minix.git fix race condition that can trigger 'enqueue already ready process' panic. --- diff --git a/kernel/clock.c b/kernel/clock.c index 80cc4c474..7124a8588 100755 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -107,8 +107,12 @@ message *m_ptr; /* pointer to request message */ */ if (prev_ptr->p_ticks_left <= 0 && priv(prev_ptr)->s_flags & PREEMPTIBLE) { if(prev_ptr->p_rts_flags == 0) { /* if it was runnable .. */ - lock_dequeue(prev_ptr); /* take it off the queues */ - lock_enqueue(prev_ptr); /* and reinsert it again */ + lock; + { + dequeue(prev_ptr); /* take it off the queues */ + enqueue(prev_ptr); /* and reinsert it again */ + } + unlock; } else { kprintf("CLOCK: %d not runnable; flags: %x\n", prev_ptr->p_endpoint, prev_ptr->p_rts_flags);