diff options
author | Christopher Faylor <me@cgf.cx> | 2004-03-30 21:27:50 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-03-30 21:27:50 +0000 |
commit | c83bdbf65e589a40b6f01bcdf586e91391013647 (patch) | |
tree | 3db2e2f5760ac75e0f2238b65fb8400a052c9495 /winsup/cygwin | |
parent | cacc0d4421219bf48aca9ce3b0e13344c1ed753e (diff) | |
download | cygnal-c83bdbf65e589a40b6f01bcdf586e91391013647.tar.gz cygnal-c83bdbf65e589a40b6f01bcdf586e91391013647.tar.bz2 cygnal-c83bdbf65e589a40b6f01bcdf586e91391013647.zip |
* thread.h (pthread::init_mainthread): Add parameter forked. Set forked
default to false..
* thread.cc (MTinterface::fixup_after_fork): Call pthread::init_mainthread with
forked = true.
(pthread::init_mainthread): Add parameter forked. Do not change thread self
pointer when forked.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 15 | ||||
-rw-r--r-- | winsup/cygwin/thread.h | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b81057696..9227f5cde 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2004-03-30 Thomas Pfaff <tpfaff@gmx.net> + + * thread.h (pthread::init_mainthread): Add parameter forked. Set + forked default to false.. + * thread.cc (MTinterface::fixup_after_fork): Call + pthread::init_mainthread with forked = true. + (pthread::init_mainthread): Add parameter forked. Do not change thread + self pointer when forked. + 2004-03-30 Corinna Vinschen <corinna@vinschen.de> * shm.cc (shmat): If shmid is unknown, call a special variation diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index a18834ddf..3652a91fa 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -153,7 +153,7 @@ MTinterface::fixup_after_fork (void) pthread_key::fixup_after_fork (); threadcount = 0; - pthread::init_mainthread (); + pthread::init_mainthread (true); pthread::fixup_after_fork (); pthread_mutex::fixup_after_fork (); @@ -166,14 +166,19 @@ MTinterface::fixup_after_fork (void) /* static methods */ void -pthread::init_mainthread () +pthread::init_mainthread (const bool forked) { pthread *thread = get_tls_self_pointer (); if (!thread) { - thread = new pthread (); - if (!thread) - api_fatal ("failed to create mainthread object"); + if (forked) + thread = pthread_null::get_null_pthread (); + else + { + thread = new pthread (); + if (!thread) + api_fatal ("failed to create mainthread object"); + } } thread->cygtls = &_my_tls; diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 02eac1899..ac08cdfde 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -373,7 +373,7 @@ public: pthread (); virtual ~pthread (); - static void init_mainthread (); + static void init_mainthread (const bool forked = false); static bool is_good_object(pthread_t const *); static void atforkprepare(); static void atforkparent(); |