BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / commit / 4d3c382801026ca46da937de6d7261f1f6805d9e / task / scheduler.c

// Related

Nucleus

Barry Object Lists + replacing Task Queues 4d3c382 (3 years, 3 months ago)
diff --git a/task/scheduler.c b/task/scheduler.c
index 06012ae..7b08fc2 100644
--- a/task/scheduler.c
+++ b/task/scheduler.c
@@ -11,7 +11,7 @@
 
 #define PRIORITY_COUNT 6
 
-TaskQueue *readyQueue[PRIORITY_COUNT];
+ObjectList *readyQueue[PRIORITY_COUNT];
 
 /* Switch to a task */
 static void
@@ -41,12 +41,12 @@ end:
 }
 
 /* Find the next schedulable ready queue */
-static TaskQueue *
+static ObjectList *
 highest_priority_queue(void)
 {
 	enum Priority p;
 	for (p = PRIORITY_COUNT - 1; p > 0; p--) {
-		if (tasks_in_queue(readyQueue[p]))
+		if (count(readyQueue[p]))
 			return readyQueue[p];
 	}
 	return NULL;
@@ -57,15 +57,15 @@ void
 schedule(void)
 {
 	Task *task = current;
-	TaskQueue *queue = highest_priority_queue();
+	ObjectList *queue = highest_priority_queue();
 
 	/* Next schedulable task */
 	if (queue) {
-		task = pop_from_queue(queue);
+		task = pop_from_start(queue);
 		task->state = RUNNING;
 		if (current->state == RUNNING) {
 			current->state = READY;
-			add_to_queue(readyQueue[current->priority], current);
+			add(readyQueue[current->priority], current);
 		}
 		switch_to_task(task);
 	/* Idle */
@@ -76,7 +76,7 @@ schedule(void)
 			asm volatile("hlt");
 		asm volatile("cli");
 		current = task;
-		task = pop_from_queue(queue);
+		task = pop_from_start(queue);
 		task->state = RUNNING;
 		switch_to_task(task);
 	}
@@ -88,5 +88,5 @@ init_scheduler(void)
 {
 	enum Priority p;
 	for (p = 0; p < PRIORITY_COUNT; p++)
-		readyQueue[p] = new(&taskQueueType);
+		readyQueue[p] = create_list(&taskType);
 }