From 4e8586dfa35bf5114c0f620bdfcd2e0466e952a8 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 19 Jan 2007 15:09:39 +0000 Subject: [MINIOS] More cleanups for the ia64 port. Signed-off-by: Dietmar Hahn --- extras/mini-os/sched.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'extras/mini-os/sched.c') diff --git a/extras/mini-os/sched.c b/extras/mini-os/sched.c index 9b111c28e5..69f398ed13 100644 --- a/extras/mini-os/sched.c +++ b/extras/mini-os/sched.c @@ -155,11 +155,27 @@ void schedule(void) if(prev != next) switch_threads(prev, next); } - -/* Gets run when a new thread is scheduled the first time ever, - defined in x86_[32/64].S */ -extern void thread_starter(void); - +struct thread* create_thread(char *name, void (*function)(void *), void *data) +{ + struct thread *thread; + unsigned long flags; + /* Call architecture specific setup. */ + thread = arch_create_thread(name, function, data); + /* Not runable, not exited, not sleeping */ + thread->flags = 0; + thread->wakeup_time = 0LL; + set_runnable(thread); + local_irq_save(flags); + if(idle_thread != NULL) { + list_add_tail(&thread->thread_list, &idle_thread->thread_list); + } else if(function != idle_thread_fn) + { + printk("BUG: Not allowed to create thread before initialising scheduler.\n"); + BUG(); + } + local_irq_restore(flags); + return thread; +} void exit_thread(void) { -- cgit v1.2.3