Skip to content
Snippets Groups Projects
Commit f4584982 authored by Elizabeth Baker's avatar Elizabeth Baker
Browse files

buffProc -not for task4 test 2

parent fb8555d1
Branches
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment