]> Zhao Yanbai Git Server - minix.git/commitdiff
fix race condition that can trigger 'enqueue already ready process' panic.
authorBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 13:42:37 +0000 (13:42 +0000)
committerBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 13:42:37 +0000 (13:42 +0000)
kernel/clock.c

index 80cc4c47489685dc92a4b2bb557742068d11cd9c..7124a8588b247e745e834a9ff54e7cbc06fe3236 100755 (executable)
@@ -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);