Boost logo

Boost Users :

From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-08-15 16:16:41


Stephen Torri <storri_at_[hidden]> writes:

> I would like to have a function object that I can use the return value
> of its operator() function.

> Where is the point I should be catching return from the operator()
> function? I want the thread to do work and then have the opportunity to
> get some results from it. Is there a code example someone can show me?

boost::thread discards the return value from the thread function or
function object. If you want the return value, you need to use
something like the proposed Boost futures library. My implementation
is here:

http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html

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-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