From f1205aa71fb0131eb9d1e2efdd5fbcfaa85ad27c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 3 Aug 2003 06:47:02 +0000 Subject: Update. * sysdeps/pthread/createthread.c (do_clone): If __ASSUME_CLONE_STOPPED is not defined, do explicit synchronization. (create_thread): Do not lock pd->lock here. If __ASSUME_CLONE_STOPPED is not defined also unlock pd->lock for non-debugging case in case it is necessary. * pthread_create.c (start_thread): Always get and release pd->lock if __ASSUME_CLONE_STOPPED is not defined. (start_thread_debug): Removed. Adjust users. * allocatestack.c (allocate_stack): Always initialize lock if __ASSUME_CLONE_STOPPED is not defined. * Makefile (tests): Add tst-sched1. * tst-sched1.c: New file. --- nptl/pthread_create.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'nptl/pthread_create.c') diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index ae97f4a62d..8507c3bf1d 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -33,8 +33,6 @@ /* Local function to start thread and handle cleanup. */ static int start_thread (void *arg); -/* Similar version used when debugging. */ -static int start_thread_debug (void *arg); /* Nozero if debugging mode is enabled. */ @@ -232,6 +230,13 @@ start_thread (void *arg) struct pthread *pd = (struct pthread *) arg; +#ifndef __ASSUME_CLONE_STOPPED + /* Get the lock the parent locked to force synchronization. */ + lll_lock (pd->lock); + /* And give it up right away. */ + lll_unlock (pd->lock); +#endif + #if HP_TIMING_AVAIL /* Remember the time when the thread was started. */ hp_timing_t now; @@ -331,23 +336,6 @@ start_thread (void *arg) } -/* Just list start_thread but we do some more things needed for a run - with a debugger attached. */ -static int -start_thread_debug (void *arg) -{ - struct pthread *pd = (struct pthread *) arg; - - /* Get the lock the parent locked to force synchronization. */ - lll_lock (pd->lock); - /* And give it up right away. */ - lll_unlock (pd->lock); - - /* Now do the actual startup. */ - return start_thread (arg); -} - - /* Default thread attributes for the case when the user does not provide any. */ static const struct pthread_attr default_attr = -- cgit 1.4.1