From: restor on
Hi,
I have seen, that the thread cancellation functionality has been
removed from threads library paper. Does it mean we are not going to
have the ability to cancel a thread in C++0x or is there going to be
an alternative mechanism for it?

Regards,
&rzej

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Anthony Williams on
restor <akrzemi1(a)interia.pl> writes:

> I have seen, that the thread cancellation functionality has been
> removed from threads library paper. Does it mean we are not going to
> have the ability to cancel a thread in C++0x or is there going to be
> an alternative mechanism for it?

Thread cancellation will not be in C++0x.

I will be proposing cooperative thread interruption for TR2, but for now
you'll have to make do with the interruption support I've implemented in the
Boost.thread library
(<http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html>). See the
description on my blog:
<http://www.justsoftwaresolutions.co.uk/threading/thread-interruption-in-boost-thread-library.html>

Anthony
--
Anthony Williams | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Alberto Ganesh Barbati on
restor ha scritto:
> Hi,
> I have seen, that the thread cancellation functionality has been
> removed from threads library paper. Does it mean we are not going to
> have the ability to cancel a thread in C++0x or is there going to be
> an alternative mechanism for it?
>

The WG14 (the working group of the C language) has expressed negatively
about co-operative cancellation of threads in this paper
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2455.pdf . I'm
not in the position to foresee what the committee will decide about the
issue, but it seems unlikely that cancellation is going to be considered
again in the near future.

Just my opinion,

Ganesh

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Sohail Somani on
On Tue, 01 Apr 2008 14:57:34 -0600, Anthony Williams wrote:

> Thread cancellation will not be in C++0x.
>
> I will be proposing cooperative thread interruption for TR2, but for now
> you'll have to make do with the interruption support I've implemented in
> the Boost.thread library
> (<http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html>). See the
> description on my blog:
> <http://www.justsoftwaresolutions.co.uk/threading/thread-interruption-
in-boost-thread-library.html>

Just read over it. Looks very useful. I look forward to its inclusion.

One question though: could you not have had a thread-specific stack of
enable/disable interruption flags? It seems kind of weird to pass around
objects for this purpose.



--
Sohail Somani
http://uint32t.blogspot.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Anthony Williams on
Sohail Somani <sohail(a)taggedtype.net> writes:

> On Tue, 01 Apr 2008 14:57:34 -0600, Anthony Williams wrote:
>
>> Thread cancellation will not be in C++0x.
>>
>> I will be proposing cooperative thread interruption for TR2, but for now
>> you'll have to make do with the interruption support I've implemented in
>> the Boost.thread library
>> (<http://www.boost.org/doc/libs/1_35_0/doc/html/thread.html>). See the
>> description on my blog:
>> <http://www.justsoftwaresolutions.co.uk/threading/thread-interruption-
> in-boost-thread-library.html>
>
> Just read over it. Looks very useful. I look forward to its inclusion.
>
> One question though: could you not have had a thread-specific stack of
> enable/disable interruption flags? It seems kind of weird to pass around
> objects for this purpose.

You could have a thread-specific stack of flags, and that's essentially what
disable_interruption objects give you, in an exception-safe manner: you
generally only want interruption disabled for a specific region of code, and
you want to restore it to whatever it was before when you're done, even if you
leave with an exception.

Anthony
--
Anthony Williams | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]