diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-09-25 07:44:41 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-09-25 07:44:41 +0000 |
commit | 5f66b766e7b1929b07ab3e0374a9a627a45c9be6 (patch) | |
tree | 337255bdc09e5c1f32039ae5f732eeef8059de79 /nptl | |
parent | 51499423041892397b8ee123bbe45fd8eadda534 (diff) | |
download | glibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.zip glibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.tar.gz glibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.tar.bz2 |
Update.
2004-09-25 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/setuid.c (__setuid): Remove second
result declaration.
2004-09-22 Andreas Schwab <schwab@suse.de>
* sysdeps/unix/sysv/linux/ia64/sysdep.h: Adjust whitespace.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 8 | ||||
-rw-r--r-- | nptl/descr.h | 3 | ||||
-rw-r--r-- | nptl/pthread_create.c | 15 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/createthread.c | 8 |
4 files changed, 26 insertions, 8 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 01c6c10..157b793 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,11 @@ +2004-09-25 Ulrich Drepper <drepper@redhat.com> + + * descr.h (struct pthread): Add stopped_start field. + * sysdeps/pthread/createthread.c (create_thread): Set + start_stopped flag in descriptor for new thread appropriately. + * pthread_create.c (start_thread): Only take lock to be stopped on + startup if stopped_start flag says so. + 2004-09-24 Ulrich Drepper <drepper@redhat.com> * pthread_create.c (__pthread_create_2_1): Remember whether thread diff --git a/nptl/descr.h b/nptl/descr.h index 0f8d347..d813929 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -197,6 +197,9 @@ struct pthread /* True if the user provided the stack. */ bool user_stack; + /* True if thread must stop at startup time. */ + bool stopped_start; + /* Lock to synchronize access to the descriptor. */ lll_lock_t lock; diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 34cc37d..1bab72d 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -252,14 +252,17 @@ start_thread (void *arg) /* Store the new cleanup handler info. */ THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf); - int oldtype = CANCEL_ASYNC (); + if (__builtin_expect (pd->stopped_start, 0)) + { + int oldtype = CANCEL_ASYNC (); - /* Get the lock the parent locked to force synchronization. */ - lll_lock (pd->lock); - /* And give it up right away. */ - lll_unlock (pd->lock); + /* Get the lock the parent locked to force synchronization. */ + lll_lock (pd->lock); + /* And give it up right away. */ + lll_unlock (pd->lock); - CANCEL_RESET (oldtype); + CANCEL_RESET (oldtype); + } /* Run the code the user provided. */ #ifdef CALL_THREAD_FCT diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c index fb8d8ce..8620519 100644 --- a/nptl/sysdeps/pthread/createthread.c +++ b/nptl/sysdeps/pthread/createthread.c @@ -186,6 +186,9 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, if ((_mask & (__nptl_threads_events.event_bits[_idx] | pd->eventbuf.eventmask.event_bits[_idx])) != 0) { + /* We always must have the thread start stopped. */ + pd->stopped_start = true; + /* Create the thread. We always create the thread stopped so that it does not get far before we tell the debugger. */ int res = do_clone (pd, attr, clone_flags, start_thread, @@ -224,10 +227,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, /* Determine whether the newly created threads has to be started stopped since we have to set the scheduling parameters or set the affinity. */ - int stopped = 0; + bool stopped = false; if (attr != NULL && (attr->cpuset != NULL || (attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)) - stopped = 1; + stopped = true; + pd->stopped_start = stopped; /* Actually create the thread. */ int res = do_clone (pd, attr, clone_flags, start_thread, |