summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-12-08 17:55:33 +0100
committerCorinna Vinschen <corinna@vinschen.de>2015-12-08 17:55:33 +0100
commit6c3a5d263f3cdfb6703434439bdc84c3a1e29159 (patch)
treecdf31c6b1eb1c087a39b8f10fa3a6bd7ef8c8f7c
parentd0f5f4c422f0bcb89a7dcfc692202ccc1ee12316 (diff)
downloadcygnal-6c3a5d263f3cdfb6703434439bdc84c3a1e29159.tar.gz
cygnal-6c3a5d263f3cdfb6703434439bdc84c3a1e29159.tar.bz2
cygnal-6c3a5d263f3cdfb6703434439bdc84c3a1e29159.zip
Remove unnecessary locking in pthread_setcancelstate/pthread_setcanceltype
* thread.cc (pthread::setcancelstate): Remove unnecessary locking. (pthread::setcanceltype): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/thread.cc36
2 files changed, 15 insertions, 26 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c585dd984..16282e01f 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
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
to align with Microsoft naming scheme.
(FILE_INTERNAL_INFORMATION): Ditto.
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index ff8459015..8f299008b 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -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