BarryServer : Git

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

// Related

Nucleus

Barry Exiting interrupt context on clone() child 571b85e (3 years, 3 months ago)
diff --git a/task/scheduler.c b/task/scheduler.c
index 7b08fc2..1bc0f55 100644
--- a/task/scheduler.c
+++ b/task/scheduler.c
@@ -38,6 +38,8 @@ switch_to_task(Task *task)
 		   "g" (current->ebp), "g" (current->pageDir)
 	);
 end:
+	/* This prevents GCC from optimising the jump to be after the return */
+	__atomic_thread_fence(__ATOMIC_ACQ_REL);
 }
 
 /* Find the next schedulable ready queue */
@@ -56,6 +58,9 @@ highest_priority_queue(void)
 void
 schedule(void)
 {
+	if (current->inCriticalSection)
+		return;
+
 	Task *task = current;
 	ObjectList *queue = highest_priority_queue();