Skip to contentSkip to conversation

Add exit_thread prototype. Make sure exit_thread doesn't return by accident

PATCH New Samuel Thibault 1 participant 1 message Jan 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add exit_thread prototype. Make sure exit_thread doesn't return by accident

Add exit_thread prototype. Make sure exit_thread doesn't return by accident.

# HG changeset patch
# User Samuel Thibault <[email protected]>
# Date 1200577127 0
# Node ID a7922b798098383d87bd62a4cc27595cfaad8dbe
# Parent 7f206dc573bcf5660c9cbbc6c3658f7d8c03a855
Add exit_thread prototype. Make sure exit_thread doesn't return by accident.

extras/mini-os/include/sched.h +1 -0
diff -r 7f206dc573bc -r a7922b798098 extras/mini-os/include/sched.h
@@ -39,6 +39,7 @@ void init_sched(void);
 void init_sched(void);
 void run_idle_thread(void);
 struct thread* create_thread(char *name, void (*function)(void *), void *data);
+void exit_thread(void) __attribute__((noreturn));
 void schedule(void);
 
 #define current get_current()
extras/mini-os/sched.c +5 -1
diff -r 7f206dc573bc -r a7922b798098 extras/mini-os/sched.c
@@ -198,7 +198,11 @@ void exit_thread(void)
     list_add(&thread->thread_list, &exited_threads);
     local_irq_restore(flags);
     /* Schedule will free the resources */
-    schedule();
+    while(1)
+    {
+        schedule();
+        printk("schedule() returned!  Trying again\n");
+    }
 }
 
 void block(struct thread *thread)