Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-11-14 05:51:40


"Preston A. Elder" <prez_at_[hidden]> writes:

> On Wed, 14 Nov 2007 03:22:29 +0000, Preston A. Elder wrote:
>
>> So, is it possible to get this fixed? :)
>
> .. And while I'm at it, a way to cancel pending interrupts would also be
> good. If I know an interrupt has been requested (hell, thread-
>>interruption_requested() tells me that), I should be able to cancel the
> pending interrupt and take action myself. Rather than having to acquire
> a lock spuriously so I can get interrupted (which clears the pending
> interrupt) and catch the exception to THEN take action.

It's a little messy, but

try
{
    this_thread::interruption_point();
}
catch(thread_interrupted const&)
{}

does the trick. You could easily wrap it in a function. However, your code
might be interrupted again straight away, so it's not 100% reliable.

Why do you need this?

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