* thread.cc (pthread::precreate): Use explicit "no inherit" option when

creating mutex.
(pthread_mutex::nativeMutex::init): Ditto.
(semaphore::semaphore): Ditto.
This commit is contained in:
Christopher Faylor 2002-09-30 15:05:00 +00:00
parent e58273df45
commit bd2b5664a1
2 changed files with 21 additions and 14 deletions

View File

@ -1,3 +1,10 @@
2002-09-30 Christopher Faylor <cgf@redhat.com>
* thread.cc (pthread::precreate): Use explicit "no inherit" option when
creating mutex.
(pthread_mutex::nativeMutex::init): Ditto.
(semaphore::semaphore): Ditto.
2002-09-30 Christopher Faylor <cgf@redhat.com> 2002-09-30 Christopher Faylor <cgf@redhat.com>
* thread.cc (pthread_key::keys): Do not copy on fork. * thread.cc (pthread_key::keys): Do not copy on fork.

View File

@ -317,7 +317,7 @@ pthread::precreate (pthread_attr *newattr)
return; return;
} }
cancel_event = ::CreateEvent (NULL,TRUE,FALSE,NULL); cancel_event = ::CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
if (!cancel_event) if (!cancel_event)
{ {
system_printf ("couldn't create cancel event, this %p LastError %E", this); system_printf ("couldn't create cancel event, this %p LastError %E", this);
@ -1105,7 +1105,7 @@ pthread_mutex::nativeMutex pthread_mutex::mutexInitializationLock NO_COPY;
void void
pthread_mutex::initMutex () pthread_mutex::initMutex ()
{ {
if (!mutexInitializationLock.init()) if (!mutexInitializationLock.init ())
api_fatal ("Could not create win32 Mutex for pthread mutex static initializer support.\n"); api_fatal ("Could not create win32 Mutex for pthread mutex static initializer support.\n");
} }
@ -1213,9 +1213,9 @@ pthread_mutex::fixup_after_fork ()
} }
bool bool
pthread_mutex::nativeMutex::init() pthread_mutex::nativeMutex::init ()
{ {
theHandle = CreateMutex (NULL, FALSE, NULL); theHandle = CreateMutex (&sec_none_nih, FALSE, NULL);
if (!theHandle) if (!theHandle)
{ {
debug_printf ("CreateMutex failed. %E"); debug_printf ("CreateMutex failed. %E");
@ -1225,7 +1225,7 @@ pthread_mutex::nativeMutex::init()
} }
bool bool
pthread_mutex::nativeMutex::lock() pthread_mutex::nativeMutex::lock ()
{ {
DWORD waitResult = WaitForSingleObject (theHandle, INFINITE); DWORD waitResult = WaitForSingleObject (theHandle, INFINITE);
if (waitResult != WAIT_OBJECT_0) if (waitResult != WAIT_OBJECT_0)
@ -1237,7 +1237,7 @@ pthread_mutex::nativeMutex::lock()
} }
void void
pthread_mutex::nativeMutex::unlock() pthread_mutex::nativeMutex::unlock ()
{ {
if (!ReleaseMutex (theHandle)) if (!ReleaseMutex (theHandle))
system_printf ("Received a unexpected result releasing mutex. %E"); system_printf ("Received a unexpected result releasing mutex. %E");
@ -2251,13 +2251,13 @@ pthread_mutex::init (pthread_mutex_t *mutex,
{ {
if (attr && !pthread_mutexattr::isGoodObject (attr) || check_valid_pointer (mutex)) if (attr && !pthread_mutexattr::isGoodObject (attr) || check_valid_pointer (mutex))
return EINVAL; return EINVAL;
if (!mutexInitializationLock.lock()) if (!mutexInitializationLock.lock ())
return EINVAL; return EINVAL;
/* FIXME: bugfix: we should check *mutex being a valid address */ /* FIXME: bugfix: we should check *mutex being a valid address */
if (isGoodObject (mutex)) if (isGoodObject (mutex))
{ {
mutexInitializationLock.unlock(); mutexInitializationLock.unlock ();
return EBUSY; return EBUSY;
} }
@ -2266,10 +2266,10 @@ pthread_mutex::init (pthread_mutex_t *mutex,
{ {
delete (*mutex); delete (*mutex);
*mutex = NULL; *mutex = NULL;
mutexInitializationLock.unlock(); mutexInitializationLock.unlock ();
return EAGAIN; return EAGAIN;
} }
mutexInitializationLock.unlock(); mutexInitializationLock.unlock ();
return 0; return 0;
} }