Boost logo

Boost :

From: Tom Becker (voidampersand_at_[hidden])
Date: 2002-01-14 12:57:19


On Mon, 14 Jan 2002 15:18:36 -0000, "bill_kempf"
<williamkempf_at_[hidden]> wrote:
>Generally, the library defines certain functions as "cancellation
>points". A CheckForCancellation() is often a "free" cancellation
>point, but methods known to block a thread for an indeterminate
>amount of time (such as mutex locking) are generally made
>cancellation points as well. This allows the blocking function to
>return the instant (or close to) that a cancellation request is made,
>instead of having to finish the blocking operation. This can
>actually be important to avoid some deadlock situations.

That definitely seems like the right approach. It's safe because the
developer can know which library functions might throw. I think some
sort of CheckForCancellation() function is still necessary, so it's
possible to cancel a compute-bound thread. But it's better if the
developer doesn't have to painstakingly add code before and after
every blocking call.

   Tom

-- 
Tom Becker                      "Within C++, there is a much smaller and
<voidampersand_at_[hidden]>        cleaner language struggling to get out."
                                                       -- Bjarne Stroustrup

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