Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2006-10-18 05:52:30


Hi Giovanni,

On 10/18/06, Giovanni P. Deretta <gpderetta_at_[hidden]> wrote:
> Dean Michael Berris wrote:
> >
> > Insights and pointers will be most appreciated.
> >
>

[snipped]

>
> While the road to a full active object is long, may be my library is a
> good start. BTW, coroutines might be a much better way,
> performance-wise, to implement Active Objects with one thread per object
> or a thread pool.
>

Coroutines (if I understand correctly) solve a completely different
set of design challenges, mostly related to maintaining state accross
reentrant calls to the coroutine -- while Active Objects [See
http://www.cs.wustl.edu/~schmidt/PDF/Act-Obj.pdf] just aim to decouple
the method execution (of member methods) from the invocation and
return values are wrapped in Futures.

I had been more or less influenced by Herb Sutter's presentation on
the Concur project and the idea of:

active class my_class {
  void operation() {
    // do some work here
  };

  int another_operation() {
    int a_value = 0;
    // do some work here on a_value
    return a_value;
  };
};

// somewhere in client code...

my_class instance;
instance.operation() // immediately returns
future<int> a_value = instance.another_operation(); // immediately returns
// do some other work
cout << a_value.get() << std::endl; // will wait for a_value to "have a value"

> You can look at the code and see if it fits your need here:
>
> https://www.boost-consulting.com:8443/trac/soc/browser/boost/soc/2006/coroutine/trunk
>
> docs here:
>
> http://www.crystalclearsoftware.com/soc/coroutine/index.html
>

I'm doing that at the moment and so far it's been very interesting. I
might not be using this library though for our current project (or
anytime soon) because we've already had a lot of code written to
implement the active object pattern. It is going to be worth a second
look though I bet, when it gets reviewed and maybe eventually included
in Boost.

> Currently real life prevent me from cleaning up the library for a boost
> review request, but plan to do it short term.
>

Good luck! :-)

> HTH,

Definitely does. Thanks! :-)

-- 
Dean Michael C. Berris
C++ Software Architect
Orange and Bronze Software Labs, Ltd. Co.
web: http://software.orangeandbronze.com/
email: dean_at_[hidden]
mobile: +63 928 7291459
phone: +63 2 8943415
other: +1 408 4049532
blogs: http://mikhailberis.blogspot.com http://3w-agility.blogspot.com
http://cplusplus-soup.blogspot.com

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