Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-18 20:32:55


Dean Michael Berris wrote:

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

It isn't clear to me how this simple model can handle synchronization
constraints; do all "active calls" run in parallel? Sequentially? What if I
want some of them to run in parallel and some of them to obey sequential
consistency?

Given an appropriate Executor (as in N2096), it's easy to emulate
asynchronous calls as

future<int> r = ex.execute( bind( &my_class::f, &instance ) );

or maybe even

future<int> r = active( &my_class::f, &instance );

// future<int> r = active { instance.f() } in Concur?

if we trust the implementation to provide an optimal default executor (an
adaptive thread pool, most likely.)

But the real world is usually not as simple.


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