From 5c40257f6448ff4bebf7378289585adce3aa2d65 Mon Sep 17 00:00:00 2001 From: mtm Date: Wed, 30 Jun 2004 15:57:36 +0000 Subject: When a thread is created suspended have libthr suspend it explicitly instead of asking the kernel to do it when we create the thread. --- lib/libthr/thread/thr_create.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 27b19c6..8eff861 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -150,17 +150,10 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, /* * Create the thread. - * */ - if (pattr->suspend == PTHREAD_CREATE_SUSPENDED) { + if (pattr->suspend == PTHREAD_CREATE_SUSPENDED) new_thread->flags |= PTHREAD_FLAGS_SUSPENDED; - flags = THR_SUSPENDED; - } else { - flags = 0; - } - ret = thr_create(&new_thread->ctx, &new_thread->thr_id, flags); - if (ret != 0) { _thread_printf(STDERR_FILENO, "thr_create() == %d\n", ret); PANIC("thr_create"); @@ -177,8 +170,8 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, void _thread_start(void) { - - /* Run the current thread's start routine with argument: */ + if ((curthread->flags & PTHREAD_FLAGS_SUSPENDED) != 0) + _thread_suspend(curthread, NULL); pthread_exit(curthread->start_routine(curthread->arg)); /* This point should never be reached. */ -- cgit v1.1