summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2004-06-30 15:57:36 +0000
committermtm <mtm@FreeBSD.org>2004-06-30 15:57:36 +0000
commit5c40257f6448ff4bebf7378289585adce3aa2d65 (patch)
tree86a3c1b2173044749bb13667b247ea1fa6015eac /lib
parent0d2007fe4f9210e8fe7692c777109824a82c99e3 (diff)
downloadFreeBSD-src-5c40257f6448ff4bebf7378289585adce3aa2d65.zip
FreeBSD-src-5c40257f6448ff4bebf7378289585adce3aa2d65.tar.gz
When a thread is created suspended have libthr suspend it explicitly
instead of asking the kernel to do it when we create the thread.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_create.c13
1 files changed, 3 insertions, 10 deletions
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. */
OpenPOWER on IntegriCloud