Explorar o código

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 %!s(int64=6) %!d(string=hai) anos
pai
achega
63613967fd
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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;