Fix race condition with scheduler starting before task list is populated
authorJohn Hodge <[email protected]>
Fri, 25 Sep 2009 02:37:03 +0000 (10:37 +0800)
committerJohn Hodge <[email protected]>
Fri, 25 Sep 2009 02:37:03 +0000 (10:37 +0800)
Kernel/arch/x86/proc.c
Kernel/threads.c

index 48a3c1a..2413a6e 100644 (file)
@@ -40,7 +40,7 @@ void  Proc_Scheduler();
 // === GLOBALS ===
 // --- Current State ---
 #if USE_MP
-tThread        *gCurrentThread[MAX_CPUS] = NULL;
+tThread        *gCurrentThread[MAX_CPUS] = {NULL};
 #else
 tThread        *gCurrentThread = NULL;
 #endif
@@ -141,7 +141,14 @@ void ArchThreads_Init()
        
        // Change Stacks
        Proc_ChangeStack();
-       
+}
+
+/**
+ * \fn void Proc_Start()
+ * \brief Start process scheduler
+ */
+void Proc_Start()
+{
        // Start Interrupts (and hence scheduler)
        __asm__ __volatile__("sti");
 }
index 2735661..1644b50 100644 (file)
@@ -13,6 +13,7 @@
 
 // === IMPORTS ===
 extern void    ArchThreads_Init();
+extern void    Proc_Start();
 extern tThread *Proc_GetCurThread();
 extern int     Proc_Clone(Uint *Err, Uint Flags);
 
@@ -94,6 +95,8 @@ void Threads_Init()
                for(;;) __asm__ __volatile__ ("hlt");   // Just yeilds
        }
        #endif
+       
+       Proc_Start();
 }
 
 /**

UCC git Repository :: git.ucc.asn.au