From: Loic Domaigne <tech-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
josv-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
Bert Wesarg <bert.wesarg-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
Karsten Weiss
<K.Weiss-Pt+Xe7GJXK+P2YhJcF5u+nqWYbMAw+HU@public.gmane.org>
Subject: Re: For review: pthread_setcancelstate.3
Date: Tue, 25 Nov 2008 21:48:01 +0100 [thread overview]
Message-ID: <492C6481.9090809@domaigne.com> (raw)
In-Reply-To: <cfd18e0f0811241446x79b93ac1u37078317f328e5fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Michael,
Looks good to me.
Loïc.
--
> Hi Loic,
>
> On Mon, Nov 24, 2008 at 3:56 PM, Loic Domaigne <tech-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org> wrote:
>> Gidday Michael,
>>
>>
>>>> The paragraph is important, but I found it somewhat difficult to read.
>>> Yes, I see. There was at least one clumsy wording "Since...since"
>>> which made that over-long sentence had to parse.
>> [...]
>>
>>> Thanks Loic. I took some pieces of your suggestion, and arrived at
>>> the following
>>>
>>> Setting the cancelability type to PTHREAD_CANCEL_ASYNCHRONOUS
>>> is rarely useful. Since the thread could be canceled at any
>>> time, it cannot safely reserve resources (e.g., allocating mem-
>>> ory with malloc(3)), acquire mutexes, semaphores, or locks, and
>>> so on. Reserving resources is unafe because the application
>> s/unafe/unsafe/
>
> Fixed.
>
>>> has no way of knowing what the state of these resources is when
>>> the thread is canceled; that is, did cancellation occur before
>>> the resources were reserved, while they were reserved, or after
>>> they were released? Consequently, clean-up handlers cease to
>> worse: the invariant of some internal structures might get violated (e.g. if
>> a list is used to manage chunk of memory malloc'ed, and the thread gets
>> asynchronously canceled while updating the list).
>
> Yes, maybe it's worth emphasizing that. I added a sentence, so now we have:
>
> Setting the cancelability type to PTHREAD_CANCEL_ASYNCHRONOUS
> is rarely useful. Since the thread could be canceled at any
> time, it cannot safely reserve resources (e.g., allocating mem-
> ory with malloc(3)), acquire mutexes, semaphores, or locks, and
> so on. Reserving resources is unsafe because the application
> has no way of knowing what the state of these resources is when
> the thread is canceled; that is, did cancellation occur before
> the resources were reserved, while they were reserved, or after
> they were released? Furthermore, some internal data structures
> (e.g., the linked list of free blocks managed by the malloc(3)
> family of functions) may be left in an inconsistent state if
> cancellation occurs in the middle of the function call. Conse-
> quently, clean-up handlers cease to be useful. Functions that
> can be safely asynchronously canceled are called async-cancel-
> safe functions. POSIX.1-2001 only requires that pthread_can
prev parent reply other threads:[~2008-11-25 20:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-14 17:26 For review: pthread_setcancelstate.3 Michael Kerrisk
[not found] ` <cfd18e0f0811140926r40781376t8a6340479bf8426f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-22 7:03 ` Loic Domaigne
[not found] ` <4927AEAF.6060802-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
2008-11-24 18:23 ` Michael Kerrisk
[not found] ` <cfd18e0f0811241023n55ef2a9dk3ed77455b5c36841-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-24 20:56 ` Loic Domaigne
[not found] ` <492B14E7.30403-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
2008-11-24 22:46 ` Michael Kerrisk
[not found] ` <cfd18e0f0811241446x79b93ac1u37078317f328e5fa-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-25 20:48 ` Loic Domaigne [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=492C6481.9090809@domaigne.com \
--to=tech-z4jmkddsf89wk0htik3j/w@public.gmane.org \
--cc=K.Weiss-Pt+Xe7GJXK+P2YhJcF5u+nqWYbMAw+HU@public.gmane.org \
--cc=bert.wesarg-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
--cc=josv-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.