From e320ef46a7283517aeba1decc20ffb38ed131281 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 14 Feb 2003 18:33:54 +0000 Subject: 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. --- nptl/pthread_join.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nptl/pthread_join.c') diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c index 4edbced2c1..5954af778d 100644 --- a/nptl/pthread_join.c +++ b/nptl/pthread_join.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 , 2002. @@ -50,7 +50,11 @@ pthread_join (threadid, thread_return) return EINVAL; self = THREAD_SELF; - if (pd == self || self->joinid == pd) + if (pd == self + || (self->joinid == pd + && (pd->cancelhandling + & (CANCELING_BITMASK | CANCELED_BITMASK | EXITING_BITMASK + | TERMINATED_BITMASK)) == 0)) /* This is a deadlock situation. The threads are waiting for each other to finish. Note that this is a "may" error. To be 100% sure we catch this error we would have to lock the data -- cgit v1.2.3