Re: [Boost-users] Deferred Function calls
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] 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
participants (1)
-
Sohail Somani