delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/09/30/11:11:57

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Date: Mon, 30 Sep 2002 11:12:27 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: [PATCH] change to thread.cc -- need feedback
Message-ID: <20020930151227.GA10898@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.4i

I've changed the static declarations in thread.cc to use
NO_COPY and things seem to be working better in my build.

In doing this, I noticed that a CreateEvent and a CreateMutex were using
a default argument 1 (security attributes).

I changed these to an explicit "no inherit" but I'm not 100% sure
that this is the right thing to do in all cases.

Could someone who is familiar with the code (Robert?, Thomas?) look
at the patch below and, if I got it wrong, fix this so that the
handles will be properly inherited, if required?

Oh, and I also re-GNUifed the code.

cgf

Index: thread.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/thread.cc,v
retrieving revision 1.96
diff -u -w -r1.96 thread.cc
--- thread.cc	30 Sep 2002 15:00:52 -0000	1.96
+++ thread.cc	30 Sep 2002 15:10:06 -0000
@@ -317,7 +317,7 @@
       return;
     }
 
-  cancel_event = ::CreateEvent (NULL,TRUE,FALSE,NULL);
+  cancel_event = ::CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
   if (!cancel_event)
     {
       system_printf ("couldn't create cancel event, this %p LastError %E", this);
@@ -1106,7 +1106,7 @@
 pthread_mutex::initMutex ()
 {
   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.");
 }
 
 pthread_mutex::pthread_mutex (pthread_mutexattr *attr):verifyable_object (PTHREAD_MUTEX_MAGIC)
@@ -1215,7 +1215,7 @@
 bool
 pthread_mutex::nativeMutex::init()
 {
-  theHandle = CreateMutex (NULL, FALSE, NULL);
+  theHandle = CreateMutex (&sec_none_nih, FALSE, NULL);
   if (!theHandle)
     {
       debug_printf ("CreateMutex failed. %E");

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019