summaryrefslogtreecommitdiff
path: root/nptl/pthread_cancel.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-14 18:33:54 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-14 18:33:54 +0000
commite320ef46a7283517aeba1decc20ffb38ed131281 (patch)
treebe9af48c1823694fde8d21ef1de61918b8205126 /nptl/pthread_cancel.c
parent700bf7af9f98174f33ac177332bcbcd644055474 (diff)
downloadglibc-e320ef46a7283517aeba1decc20ffb38ed131281.tar.gz
Update.
* descr.h: Define CANCELING_BIT and CANCELING_BITMASK. Introduce after CANCELTYPE_BIT, move the other bits up. Update CANCEL_RESTMASK. * init.c (sigcancel_handler): Also set CANCELING_BITMASK bit in newval. * pthread_cancel.c (pthread_cancel): Likewise. Also set CANCELING_BIT if asynchronous canceling is enabled. * pthread_join.c (pthread_join): When recognizing circular joins, take into account the other thread might be already canceled. * Makefile (tests): Add tst-join5. * tst-join5.c: New file.
Diffstat (limited to 'nptl/pthread_cancel.c')
-rw-r--r--nptl/pthread_cancel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index a189b6eac9..0dd97a27e5 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -31,7 +31,7 @@ pthread_cancel (th)
while (1)
{
int oldval = pd->cancelhandling;
- int newval = oldval | CANCELED_BITMASK;
+ int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
/* Avoid doing unnecessary work. The atomic operation can
potentially be expensive if the bug has to be locked and
@@ -44,6 +44,9 @@ pthread_cancel (th)
expensive. */
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
+ /* Mark the cancellation as "in progress". */
+ atomic_bit_set (&pd->cancelhandling, CANCELING_BIT);
+
/* The cancellation handler will take care of marking the
thread as canceled. */
__pthread_kill (th, SIGCANCEL);