Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-02-05 19:35:47


Wolfgang Bangerth wrote:
[...]
> > async_result<double> res;
> > thread t(bind(res.call(), a, b, c));
> > // do something else
> > d = res.value(); // Explicitly waits for the thread to return a value?
>
> This does the same, indeed. Starting a thread this way is just a little
> more complex (and -- in my view -- less obvious to read) than writing
> thread t = spawn(foo)(a,b,c);

  joinable_thread_ptr< double > tp = new_thread(foo, a, b, c);
  d = *tp->join(); // double pointer is used to report cancelation
                   // and timedjoin() timeout; in this case, the
                   // thread shall never be canceled.

>
> But that's just personal opinion, and I'm arguably biased :-)

Right. ;-)

regards,
alexander.

> PS: Can you do me a favor and CC: me? I just get the digests of the
> mailing list and replying is -- well, tedious ;-)

news://news.gmane.org/gmane.comp.lib.boost.devel


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