This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [Pavel Krauz <xkr@nettest.dk>] cancel in ptherad_join patch
- To: Andreas Jaeger <aj at suse dot de>
- Subject: Re: [Pavel Krauz <xkr@nettest.dk>] cancel in ptherad_join patch
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Mon, 27 Mar 2000 07:42:39 -0800 (PST)
- cc: Pavel Krauz <xkr at nettest dot dk>, libc-alpha Mailinglist <libc-alpha at sourceware dot cygnus dot com>
On 27 Mar 2000, Andreas Jaeger wrote:
> Date: 27 Mar 2000 10:48:28 +0200
> From: Andreas Jaeger <aj@suse.de>
> To: Pavel Krauz <xkr@nettest.dk>,
libc-alpha Mailinglist <libc-alpha@sourceware.cygnus.com>
> Subject: [Pavel Krauz <xkr@nettest.dk>] cancel in ptherad_join patch
>
>
> Hi,
>
> I've found the following bug report. Could somebody please look at
> it?
It's good to see some actual feedback on my shady cancellation work. ;)
People are looking, which is good.
Okay, let's take a look at this patch.
>Hello
>
>Here is a patch that corrects a cancel bug in pthread_join that was
>probably introduced with new extricated interface for cancel
>
>
>regards
>Pavel
>
>
>- -- join.c.bak Mon Mar 27 09:52:52 2000
>+++ join.c Mon Mar 27 09:53:29 2000
>@@ -130,11 +130,11 @@
> if (! th->p_terminated) {
> /* Register extrication interface */
> __pthread_set_own_extricate_if(self, &extr);
>- if (!(THREAD_GETMEM(self, p_canceled)
>+ if ((THREAD_GETMEM(self, p_canceled)
> && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE))
>
>- th->p_joining = self;
>- else
> already_canceled = 1;
>+ else
>+ th->p_joining = self;
> __pthread_unlock(&handle->h_lock);
>
> if (already_canceled) {
>
Note that the ! operator in if test is operator is applied to the whole
parenthesized expression. So the first change simply reverses the polarity of
the test. The second changes reverse the order of the main and else clause.
I think that what we have here is simply a case of Pavel convincing himself
that it works by making semantics-preserving transformation to something that
is easier to read!