Преглед изворни кода

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;