瀏覽代碼

so apparently the execution time of threads is random, so we have to ensure we don't let 2 cars go from the same place to the same place at the same time, or we don't know which one to delete when exit is called, since that only give coords

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

+ 1 - 1
kern/synchprobs/traffic_synch.c

@@ -229,7 +229,7 @@ void intersection_before_entry(Direction origin, Direction destination)
     while (temp)
     {
       //kprintf("New o: %d, Comp o: %d, New d: %d, Comp d: %d\n", new->origin, temp->origin, new->dest, temp->dest);
-      if (temp->origin == new->origin || (temp->origin == new->dest && temp->dest == new->origin) || (temp->dest != new->dest && (rightturn(new) || rightturn(temp))))
+      if ((temp->origin == new->origin && temp->dest != new->dest) || (temp->origin == new->dest && temp->dest == new->origin) || (temp->dest != new->dest && (rightturn(new) || rightturn(temp))))
       {
         //kprintf("Everything is fine, continue\n");
         temp = temp->next;