[cpp-threads] RE: "Agenda" for august 23-25 concurrency meeting

Lawrence Crowl crowl at google.com
Thu Aug 31 21:08:37 BST 2006


On 8/31/06, Howard Hinnant <hinnant at twcny.rr.com> wrote:
> The question I put before us, and strongly recommend that we answer
> positively is:
>
>      For asynchronous function calls, do we offer some mechanism for
>      O(1) performance
>      of the return type as we do for synchronous function calls?
>
>      thread<vector<int> > t = launch_thread(bind(compute, input data));
>      vector<int> v = t();  // is this ridiculously expensive?

I don't see how we have much choice but that the return is expensive in
some cases.  Certainly move semantics can help, but the core problem
is the final destination may not have had its storage allocated at the time
the thread computes the result.  To pick a more obvious example,

    struct huge { int array[10000]; };
    thread<huge> t = launch_thread(bind(compute, input data));
    .... delay longer than compute ....
    huge v = t();

-- 
Lawrence Crowl



More information about the cpp-threads mailing list