aboutsummaryrefslogtreecommitdiff
path: root/pcb.c
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2015-04-01 20:37:15 -0400
committerBen Burwell <ben@benburwell.com>2015-04-01 20:37:15 -0400
commitd8463e5ebbf8805c30ee6402e6667eb5f78446cc (patch)
tree9317f2ad23d89656be96fa224b04365ebf14dc57 /pcb.c
parent684fc27f6389f44102b5a3b31f62badc35a9a9ce (diff)
as of 2013-12-062013-12-06
Diffstat (limited to 'pcb.c')
-rw-r--r--pcb.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pcb.c b/pcb.c
index c69dd87..1375ae0 100644
--- a/pcb.c
+++ b/pcb.c
@@ -126,12 +126,10 @@ int insert_pcb(pcb **queue, pcb * addr, int method) {
pcb * current = *queue;
pcb * one_after;
- disable();
// if there's nothing in the queue yet, make the PCB the start
if (current == NULL) {
*queue = addr;
- enable();
return 1;
}
@@ -147,7 +145,6 @@ int insert_pcb(pcb **queue, pcb * addr, int method) {
current->next = addr;
addr->next = NULL;
addr->prev = current;
- enable();
return 1;
} else if (method == 0) {
// insert in priority order
@@ -176,10 +173,8 @@ int insert_pcb(pcb **queue, pcb * addr, int method) {
addr->next = current;
*queue = addr;
}
- enable();
return 1;
} else {
- enable();
// There was a problem, return error code
return -1;
}
@@ -191,7 +186,11 @@ int insert_pcb(pcb **queue, pcb * addr, int method) {
int remove_pcb(pcb **queue, pcb * addr) {
pcb * current = *queue;
- disable();
+ if (addr == NULL || *queue == NULL) {
+ printf("bad times ahead \n");
+ return;
+ }
+
// are we removing the head?
if (addr == *queue) {
*queue = addr->next;
@@ -215,6 +214,5 @@ int remove_pcb(pcb **queue, pcb * addr) {
}
current = current->next;
} while (current != NULL);
- enable();
return -1;
}