Boost logo

Boost :

Subject: Re: [boost] [thread] Exception based timed locks
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-01-20 09:42:18


"vicente.botet" <vicente.botet_at_[hidden]> writes:

> I've read recently about timed locks throwing an exception when
> there is a timeout. What do you think about this behaviour? Could
> the thread library provide both?

Interesting idea. It certainly tidies up the code, which is one of my
favourite features of exceptions.

> What do you think about a try_lock_until, try_lock_for functions
>
> while (polling)
> try {
> boost::try_lock_for(100, m1, m2, m3);
> foo();
> polling = false;
> } catch (timeout_exception& ex) {execute_on_failed(); }

Hmm. Interesting. Have you got some realistic use cases?

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

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