fix race condition that can trigger 'enqueue already ready process' panic.

This commit is contained in:
Ben Gras 2008-12-11 13:42:37 +00:00
parent 567f2f0ba0
commit a74132ec69

View file

@ -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_ticks_left <= 0 && priv(prev_ptr)->s_flags & PREEMPTIBLE) {
if(prev_ptr->p_rts_flags == 0) { /* if it was runnable .. */ if(prev_ptr->p_rts_flags == 0) { /* if it was runnable .. */
lock_dequeue(prev_ptr); /* take it off the queues */ lock;
lock_enqueue(prev_ptr); /* and reinsert it again */ {
dequeue(prev_ptr); /* take it off the queues */
enqueue(prev_ptr); /* and reinsert it again */
}
unlock;
} else { } else {
kprintf("CLOCK: %d not runnable; flags: %x\n", kprintf("CLOCK: %d not runnable; flags: %x\n",
prev_ptr->p_endpoint, prev_ptr->p_rts_flags); prev_ptr->p_endpoint, prev_ptr->p_rts_flags);