]> sourceware.org Git - newlib-cygwin.git/commitdiff
Remove unnecessary locking in pthread_setcancelstate/pthread_setcanceltype
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 8 Dec 2015 16:55:33 +0000 (17:55 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 8 Dec 2015 16:55:33 +0000 (17:55 +0100)
        * thread.cc (pthread::setcancelstate): Remove unnecessary locking.
        (pthread::setcanceltype): Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/ChangeLog
winsup/cygwin/thread.cc

index c585dd984eb177604dfc7ef497e61b502b7338b6..16282e01fb9a6b62a39e1f0c89fa2d1759ca1ab5 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-08  Corinna Vinschen  <corinna@vinschen.de>
+
+       * thread.cc (pthread::setcancelstate): Remove unnecessary locking.
+       (pthread::setcanceltype): Ditto.
+
 2015-12-08  Corinna Vinschen  <corinna@vinschen.de>
 
        * ntdll.h (FILE_ID_BOTH_DIR_INFORMATION): Rename FileId to IndexNumber
index ff845901554840513b87c39726fabd73da3ac19e..8f299008b0e8d5215fafa780e2fae3e96c6b8841 100644 (file)
@@ -966,43 +966,27 @@ pthread::static_cancel_self ()
 int
 pthread::setcancelstate (int state, int *oldstate)
 {
-  int result = 0;
-
-  mutex.lock ();
-
   if (state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE)
-    result = EINVAL;
-  else
-    {
-      if (oldstate)
-       *oldstate = cancelstate;
-      cancelstate = state;
-    }
+    return EINVAL;
 
-  mutex.unlock ();
+  if (oldstate)
+    *oldstate = cancelstate;
+  cancelstate = state;
 
-  return result;
+  return 0;
 }
 
 int
 pthread::setcanceltype (int type, int *oldtype)
 {
-  int result = 0;
-
-  mutex.lock ();
-
   if (type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS)
-    result = EINVAL;
-  else
-    {
-      if (oldtype)
-       *oldtype = canceltype;
-      canceltype = type;
-    }
+    return EINVAL;
 
-  mutex.unlock ();
+  if (oldtype)
+    *oldtype = canceltype;
+  canceltype = type;
 
-  return result;
+  return 0;
 }
 
 void
This page took 0.036831 seconds and 5 git commands to generate.