diff --git a/allocate.c b/allocate.c
index e929108820e894daae56a8dd2fb601d921f1140a..e2aba4b7fad9fc72d73acb1df90691ca9c23da62 100644
--- a/allocate.c
+++ b/allocate.c
@@ -450,6 +450,7 @@ process *getNextProcess(FILE *f, llist *arrivals, process *readAhead) {
return NULL;
}
+ llist_print(arrivals,(void (*)(void *)) &printQEntry);
headProcess = headData(arrivals);
if (headProcess != NULL){//thare are processes in arrivals
return llist_pop(arrivals);
@@ -483,24 +484,35 @@ process *getNextProcess(FILE *f, llist *arrivals, process *readAhead) {
//add to arrivals until the readAhead is different
//memcpy(nextProcess,readAhead, sizeof(process));
llist_add_inorder(readAhead, arrivals, (int (*)(void *, void *)) &leastExecutionTime);
+ printf("readAhead: %s\n", readAhead->processID);
+ printf("New Process: %s\n", readAhead->processID);
memcpy(readAhead,newProcess,sizeof(process));
+ printf("in if\n");
+ llist_print(arrivals,(void (*)(void *)) &printQEntry);
+ printf("readAhead: %s\n", readAhead->processID);
+
int count = 0;
while (newProcess->timeArrived == readAhead->timeArrived ){
//readAhead = nextProcess;
//memcpy(nextProcess,readAhead, sizeof(process));
- if(count > 0){
+ if(count > 0 && readAhead->timeArrived != -1){
llist_add_inorder(readAhead, arrivals, (int (*)(void *, void *)) &leastExecutionTime);
memcpy(readAhead, newProcess, sizeof(process));
+ printf("readAhead: %s\n", readAhead->processID);
}
//EOF the file assign readAhead to null then return pop(arrivals)
if(fgets(line, sizeof line, f) == NULL){
+ printf("in while, end of file\n");
+ llist_print(arrivals,(void (*)(void *)) &printQEntry);
readAhead->timeArrived = -1;
return llist_pop(arrivals);
}
initializeProcess(line,newProcess);
count =+1;
+ printf("New Process: %s\n", readAhead->processID);
}
+
llist_print(arrivals, (void (*)(void *)) &printQEntry);
//readAhead = nextProcess;