Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-03-06 18:42:45


Jason Turner wrote:

There has been some discussions about the future concept on this list and
there is an implementation of futures available in the boost sandbox vault
here: http://tinyurl.com/2bxjj5. What is the difference between this and
your proposal?

Regards Hartmut

> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Jason Turner
> Sent: Tuesday, March 06, 2007 3:54 PM
> To: boost_at_[hidden]
> Subject: [boost] active objects implementation request for comments
>
> Hi everyone. I've been lurking the mailing list for a couple
> of months now and this is my first post.
>
> I've been toying with an idea now for about 9 years, since
> college, which I only just realized that C++ and specifically
> boost gives me the tools that I need to implement it.
>
> I am hoping someone on this list would be willing to comment
> on it, as I hope to submit it for inclusion in boost relatively soon.
>
> The general concept is that a calling thread never waits for
> the return value of a function unless it needs to. In the
> case where a function is being called, this means that a new
> thread is created for a function call and an asynchronous
> return object is returned to the caller. For instance:
>
> active_object::active_return<int> ar =
> active_object::active_function(boost::function0<int>(&doStuff));
>
> a boost::thread was just created which executes doStuff() and
> stores the return value. The created thread is cleaned up at
> some later time automatically (or during application shutdown).
>
> The function template, active_function return immediately.
> The user can then wait for doStuff to be completed when he is
> concerned about it.
>
> ar.wait_for_return();
>
> or
>
> int i = ar.value();
>
> This makes creating parallel code almost trivial, which was
> the main goal of the project, to make it easy to utilize
> newer multi-core processors.
>
> Similarly an active_object exists which creates a message
> thread for an object and serializes all calls to the object:
>
> The syntax for using an active_object is a little sloppy and
> I am not sure I am 100% pleased with it:
>
> active_object::active_object<TestClass> ao(new TestClass());
>
> active_object::active_return<int> ar = ao <<
> boost::function1<int, TestClass *>(&TestClass::getInt);
> int v = ar.value();
>
> It was only after setting out to implement the project did I
> realize that this concept had been published a few years back
> under the name "Active Object"
> (http://en.wikipedia.org/wiki/Active_Object) and there are a
> couple of similar implementations floating around.
>
> Project webpage:
> http://source.emptycrate.com/projects/activeobjects/
>
> Thanks
> -Jason Turner
>
> --
> http://emptycrate.com Games, Programming, Travel & other
> stuff _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


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