This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] change to thread.cc -- need feedback


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");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]