Browse Source

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 years ago
parent
commit
63613967fd
1 changed files with 1 additions and 1 deletions
  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)
     while (temp)
     {
     {
       //kprintf("New o: %d, Comp o: %d, New d: %d, Comp d: %d\n", new->origin, temp->origin, new->dest, temp->dest);
       //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");
         //kprintf("Everything is fine, continue\n");
         temp = temp->next;
         temp = temp->next;