Boost logo

Boost Users :

Subject: Re: [Boost-users] Waiting for multiple events
From: Roland Bock (rbock_at_[hidden])
Date: 2009-12-07 16:49:31


Vadim Guchenko wrote:
> Hello, All!
>
> I want to do something like this:
>
> Wrapper wrapper(final_handler);
> w_handler1 = wrapper.wrap(handler1);
> ...
> w_handlerN = wrapper.wrap(handlerN);
>
> where the final_handler() must be invoked as soon as all the wrapped
> handlers handler1() ... handlerN() are invoked through w_handler1() ...
> w_handlerN() in any order. Is there any existing Boost tool for that?

It is not 100% clear to me what you want, but I'd say you could use
promise/future from Boost Thread:

http://www.boost.org/doc/libs/1_41_0/doc/html/thread/synchronization.html#thread.synchronization.futures

You would have promise1..N which are set by handler/wrapper1..N.

The final wrapper would have to wait for the synchronous future values
1..N and could proceed afterwards.

HTH

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net