Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-05-14 04:55:12


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

> Why you don't allow multiple callbacks? I suposse that this is related to
> the implementation of do_callback
>
> void do_callback(boost::unique_lock<boost::mutex>& lock)
> {
> if(callback && !done)
> {
> boost::function<void()> local_callback=callback;
> relocker relock(lock);
> local_callback();
> }
> }
>
> You need to call all the callbacks with the mutex unlock, and you need to
> protect from other concurrent set_wait_callback. So you will need to copy
> the list of callbacks before unlock.
>
> Is this correct?

That is correct with respect to the implementation, but I don't actually see
the need for multiple callbacks. The callbacks are set as part of the promise
or packaged_task. I can't imagine why that would require multiple
callbacks. In any case, the user can provide that facility on their own if
required.

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