Deferred Function calls

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. Any ideas would be very welcome. Thanks, Matt Davies Software Engineer Action Pants Inc.

Matt Davies wrote:
<snip>
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.
Any ideas would be very welcome.
You can use boost::bind to bind all the arguments and get a nullary functor
back, which you can store in a container as a boost::function. Something
like this (not tested):
void foo(int i, string s) { ... }
typedef boost::function
participants (2)
-
Delfin Rojas
-
Matt Davies