Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-10-24 17:30:05


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Matt Davies
>
> I am implementing a signal & slots implementation with a
> twist. Normally
> when a signal is fired the connected slots are called
> immediately. I will
> need to defer the actual calls to be invoked later.
> Basically I need to
> store the function reference (via pointer or functor) and the
> accompanying
> parameter values to a 'composite' object. This composite
> object will be
> stored on a buffer. Later another processor will pick this
> object of the
> buffer and then invoke the actual function call.
>
> I am not sure how to do this, or if it can be done. I've
> been looking at
> functors and binding functionality in Boost but I am not sure
> if I can store
> a functor with parameter values in a generic container only
> to invoke it at
> a later time. The motivation is that I want a signal & slots
> solution where
> slots are executed on different processors in a
> multi-processor environment.

I think you're on the right track. Basically, you want the interface to
be `void fn()' Binding should help you:

deferred_fn_t fn=boost::bind(the_function,1,2,3);

And have a vector of deferred_fn_t's?

HTH!

Sohail


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