Quellcode durchsuchen

removing comments, last run worked for some reason

tarfeef101 vor 6 Jahren
Ursprung
Commit
f0e054b8a2
1 geänderte Dateien mit 15 neuen und 15 gelöschten Zeilen
  1. 15 15
      kern/synchprobs/traffic_synch.c

+ 15 - 15
kern/synchprobs/traffic_synch.c

@@ -62,14 +62,14 @@ static void activeinit(void)
 // push a car to the active array
 static void push(car * newcar)
 {
-  kprintf("first third: %d", *(dirs + newcar->origin));
-  kprintf("second third: %p", *(compass + newcar->origin));
-  kprintf("third third: %d", *(*(compass + newcar->origin) + newcar->dest));
+  //kprintf("first third: %d", *(dirs + newcar->origin));
+  //kprintf("second third: %p", *(compass + newcar->origin));
+  //kprintf("third third: %d", *(*(compass + newcar->origin) + newcar->dest));
   // dirs + origin is our offset for where to start in the array
   // compass + origin is the array we use to determine what to add to the first number
   // newcar->dest gives the direction, which we use to find the offset indicating it's additive value
   int total = *(dirs + newcar->origin) + *(*(compass + newcar->origin) + newcar->dest);
-  kprintf("halfway through push\n");
+  //kprintf("halfway through push\n");
   // with our offset, set the pointer here to newcar
   *(active + total) = newcar;
 }
@@ -81,9 +81,9 @@ static void clearint(car * done)
   // compass + origin is the array we use to determine what to add to the first number
   // newcar->dest gives the direction, which we use to find the offset indicating it's additive value
   // set the array of active cars to null at this value
-  kprintf("first third: %d", *(dirs + done->origin));
-  kprintf("second third: %p", *(compass + done->origin));
-  kprintf("third third: %d", *(*(compass + done->origin) + done->dest));
+  //kprintf("first third: %d", *(dirs + done->origin));
+  //kprintf("second third: %p", *(compass + done->origin));
+  //kprintf("third third: %d", *(*(compass + done->origin) + done->dest));
   int total = *(dirs + done->origin) + *(*(compass + done->origin) + done->dest);
   *(active + total) = NULL;
   
@@ -175,7 +175,7 @@ void intersection_sync_init()
     panic("Could not allocate offset arrays.\n");
   }
 
-  kprintf("finished init steps\n");
+  //kprintf("finished init steps\n");
 }
 
 /*
@@ -212,14 +212,14 @@ void intersection_before_entry(Direction origin, Direction destination)
   car * new = newcar(origin, destination);
   
   RESTART:
-  kprintf("starting the for loop for entering\n");
+  //kprintf("starting the for loop for entering\n");
   for (int i = 0; i < 12; ++i)
   {
     car * temp = *(active + i);
     
     if (temp)
     {
-      kprintf("temp at %d was not null\n", i);
+      //kprintf("temp at %d was not null\n", i);
       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))))
       {
         continue;
@@ -232,21 +232,21 @@ void intersection_before_entry(Direction origin, Direction destination)
           temp->cv = cv_create("carcv");
         }
         
-        kprintf("put something to sleep\n");
+        //kprintf("put something to sleep\n");
         cv_wait(temp->cv, globlock); // sleep and reacquire lock once woken
         goto RESTART; // now we have to make sure there's nothing else screwing us over
       }
     }
     else
     {
-      kprintf("skipped %d because it was null\n", i);
+      //kprintf("skipped %d because it was null\n", i);
       continue;
     }
   }
   
-  kprintf("made it out of the for loop\n");
+  //kprintf("made it out of the for loop\n");
   push(new);
-  kprintf("added a car to the int\n");
+  //kprintf("added a car to the int\n");
   lock_release(globlock);
 }
 
@@ -267,6 +267,6 @@ void intersection_after_exit(Direction origin, Direction destination)
   lock_acquire(globlock);
   int position = *(dirs + origin) + *(*(compass + origin) + destination);
   clearint(*(active + position));
-  kprintf("released a car from the int\n");
+  //kprintf("released a car from the int\n");
   lock_release(globlock);
 }