Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-11-01 13:35:56


Jason Hise wrote:

>Reece Dunn wrote:
>
>>Active objects would be very hard to do *automatically* since the object is
>>a thread (very neat concept), with the constructor, methods and destructor
>>being processed as messages to the object's thread.
>>
>The main obstacle in making them work automatically is the desire to
>give them familiar syntax. If the desire to call methods directly can
>be overlooked, it seems perfectly possible to offer a generic solution.
>A simplified declaration for active <> might look something like this:
>
>template < typename Type >
>struct active : private Type
>{
> active( [...] );
>
> template < typename ReturnType [, ...] >
> future < ReturnType > enqueue( ReturnType (Type::*func) ( [...] ) [,
>...] );
>};
>
Another thought: to make the constructor and destructor queueable
actions, instead of deriving from Type, active < Type > could contain an
aligned_storage of sizeof ( Type ) and construct/destruct Type in place.

-Jason


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