瀏覽代碼

trying to not wake all, but do independently

tarfeef101 6 年之前
父節點
當前提交
7bbd784093
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      kern/synchprobs/traffic_synch.c

+ 8 - 1
kern/synchprobs/traffic_synch.c

@@ -120,7 +120,14 @@ static void clearint(car * done)
   
   if (temp->cv) // if this car was blocking something
   {
-    cv_broadcast(temp->cv, globlock); // wake all/inform them you're all good
+    //cv_broadcast(temp->cv, globlock); // wake all/inform them you're all good
+    //cv_destroy(temp->cv);
+    
+    while (!(wchan_is_empty(temp->cv->wc)))
+    {
+      cv_signal(temp->cv, globlock);
+    }
+    
     cv_destroy(temp->cv);
   }