From 404f35cb5cec4702c5f61049997f9f0661925e7a Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 30 Sep 2002 21:06:05 +0000 Subject: [PATCH] 2002-10-01 Robert Collins * thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining why. (pthreadNull::_instance): Copy on fork. Absolutely no state exists in pthreadNull. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/thread.cc | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b804b8fce..077d43b8e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2002-10-01 Robert Collins + + * thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining + why. + (pthreadNull::_instance): Copy on fork. Absolutely no state exists + in pthreadNull. + 2002-09-30 Conrad Scott * cygserver_transport_pipes.cc (transport_layer_pipes::accept): diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 8c1213a76..1ccebb24b 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -190,7 +190,7 @@ MTinterface::Init (int forked) threadcount = 1; /* 1 current thread when Init occurs.*/ pthread::initMainThread (&mainthread, myself->hProcess); - pthread_mutex::initMutex (); + pthread_mutex::initMutex (); if (forked) return; @@ -935,7 +935,8 @@ pthread_cond::fixup_after_fork () /* pthread_key */ /* static members */ -List pthread_key::keys NO_COPY; +/* This stores pthread_key information across fork() boundaries */ +List pthread_key::keys; void pthread_key::saveAKey (pthread_key *key) @@ -1097,6 +1098,7 @@ pthread_mutex::isGoodInitializerOrObject (pthread_mutex_t const *mutex) return true; } +/* This is used for mutex creation protection within a single process only */ pthread_mutex::nativeMutex pthread_mutex::mutexInitializationLock NO_COPY; /* We can only be called once. @@ -2640,6 +2642,6 @@ pthreadNull::getsequence_np () return 0; } -pthreadNull NO_COPY pthreadNull::_instance; +pthreadNull pthreadNull::_instance; #endif // MT_SAFE