aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-05-23 13:18:34 +0000
committerCorinna Vinschen <corinna@vinschen.de>2012-05-23 13:18:34 +0000
commitdacf4be3fa450920f16fe279e155e861f8cd258a (patch)
treeacd408af16af639ce0e61716685d8c97cc481a1c
parent2ca9ed527e8a18ff402e036174b2b003460fdf06 (diff)
downloadnewlib-dacf4be3fa450920f16fe279e155e861f8cd258a.zip
newlib-dacf4be3fa450920f16fe279e155e861f8cd258a.tar.gz
newlib-dacf4be3fa450920f16fe279e155e861f8cd258a.tar.bz2
* thread.cc (pthread::pop_cleanup_handler): Move setting the cancelstate
to PTHREAD_CANCEL_DISABLE from here... (pthread::pop_all_cleanup_handlers): ...to here, otherwise any explicit call to pthread_cleanup_pop disables cancellation for this thread.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/thread.cc6
2 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 264507f..ec7ff13 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2012-05-23 Corinna Vinschen <corinna@vinschen.de>
+ * thread.cc (pthread::pop_cleanup_handler): Move setting the cancelstate
+ to PTHREAD_CANCEL_DISABLE from here...
+ (pthread::pop_all_cleanup_handlers): ...to here, otherwise any explicit
+ call to pthread_cleanup_pop disables cancellation for this thread.
+
+2012-05-23 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler.h (refcnt): Add i interlocked. Explain why.
* winbase.h (ilockadd): New function.
(InterlockedAdd): Define as ilockadd.
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index f7ba60a..bb38ff3 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -1069,9 +1069,6 @@ pthread::pop_cleanup_handler (int const execute)
mutex.lock ();
- /* We will no honor cancels since the thread is exiting. */
- cancelstate = PTHREAD_CANCEL_DISABLE;
-
if (cleanup_stack != NULL)
{
__pthread_cleanup_handler *handler = cleanup_stack;
@@ -1087,6 +1084,9 @@ pthread::pop_cleanup_handler (int const execute)
void
pthread::pop_all_cleanup_handlers ()
{
+ /* We will no honor cancels since the thread is exiting. */
+ cancelstate = PTHREAD_CANCEL_DISABLE;
+
while (cleanup_stack != NULL)
pop_cleanup_handler (1);
}