Boost logo

Boost :

From: Jon Kalb (jonkalb_at_[hidden])
Date: 2005-05-04 12:22:12


 

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Beman Dawes
> Sent: Wednesday, May 04, 2005 6:31 AM
> To: Boost mailing list
> Subject: [boost] Critique of Boost.Threads
>
> With Kevlin Henney's permission, the following is a repost of
> a message he recently posted on the C++ committee's library
> reflector. It gives his views on Boost.Threads in the context
> of possible standardization.
>
> --Beman
>
> -------

I have a (newbie) question about the joiner API.

> And usage as follows:
>
> void void_task();
> int int_task();
> ...
> joiner<void> wait_for_completion = thread(void_task);
> joiner<int> wait_for_value = thread(int_task);
> ...
> int result = wait_for_value();
> wait_for_completion();

In the code snippet above does the line "int result = wait_for_value();"
block until the completion of the thread? (It must or there is no way of
knowing if the value of result is valid.) Is there a way for the client
to avoid the block by checking whether or not thread is completed so
that the call won't block... Some sort of wait_for_value.is_done()?

-- 
Jon Kalb
jonkalb_at_[hidden]

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