Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-11-14 09:26:23


"Phil Endecott" <spam_from_boost_dev_at_[hidden]> writes:

> Beman Dawes wrote:
>> Phil Endecott wrote:
>>> Anthony Williams wrote:
>>>
>>>> The interruption points are:
>>>>
>>>> thread::join, thread::timed_join
>>>> this_thread::sleep
>>>> condition_variable::wait, condition_variable::timed_wait
>>>> condition_variable_any::wait, condition_variable_any::timed_wait
>>>> this_thread::interruption_point
>>>
>>> Am I the only one who thinks that not having cancellation points at
>>> blocking I/O makes this fairly useless? Perhaps I am! I'm curious to
>>> hear about use-cases where Anthony or Preston's proposals are appropriate.
>>
>> The folks in the C++ committee's ad hoc thread working groups have been
>> discussing this for the last year or so. Several points that came up in
>> those discussions may be worth repeating:
>>
>> * For some types of I/O on some operating systems there is simply no way
>> to interrupt a blocking I/O operation once it has started. Even
>> rewriting the operating system itself wouldn't help for some hardware.
>> Rewriting the operating system isn't practical, anyhow.
>
> A balance is needed between supporting as wide a range of systems as
> possible and not holding back everyone else.
>
> I would be happy for interruption / cancellation to be specified with
> provision for each platform to indicate which underlying OS operations
> are interruptible and which are not.

The problem comes with functions that operate on generic handles (e.g. unix
file descriptors) that can reference a number of different underlying IO
mechanisms (e.g. sockets, network files, local files, pipes, etc.). The same
OS function call is then interruptible or not, depending on what the supplied
handle actually refers to. This applies to POSIX cancellation points, and is
one reason why there are so many "optional" cancellation points --- not only
does the OS not have to offer cancellation in those functions, but if they do
then they don't have to guarantee that they are always cancellation points.

Anthony

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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk