|
Boost Users : |
From: Sliwa, Przemyslaw \(London\) (Przemyslaw_Sliwa_at_[hidden])
Date: 2006-03-09 10:35:14
I was though thread is created by a pointer to a function, e.g.
Int foo(int x, int y, int z)
{
// do something with a,b,c
return a+b+c;
}
Boost::thread pop(boost::bind(&foo, a, b, c));
// do something else
pop.join();
The question is how to retrieve the result from foo running in pop.
Thanks for ideas.
Kind regards
Pshemek
Przemyslaw Sliwa
Global Foreign Exchange
FX Risk Engine Development
Merrill Lynch
( +44 (0)20 7995 4182
) +44 (0)79 6325 2319
* Email: przemyslaw_sliwa_at_[hidden]
-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Nat Goodspeed
Sent: 09 March 2006 15:15
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] How to retrieve a value from a thread
________________________________________
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Sliwa,
Przemyslaw (London)
Sent: Thursday, March 09, 2006 9:47 AM
To: boost-users_at_[hidden]
Subject: [Boost-users] How to retrieve a value from a thread
I would like to know if it is possible to retrieve a value returned from
a function which is called by a thread.
[Nat] Is this thread running continuously, doing other things? Or did
you start it for the purpose of calling that function, so that when the
function is done the thread terminates?
In Java, I've always kind of liked Doug Lea's FutureResult idiom:
http://gee.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/Future
Result.html
I don't know of anything similar in the existing library.
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
--------------------------------------------------------
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------
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