
Le 22/05/12 02:01, Chris Stankevitz a écrit :
Hi,
I'm using boost::signals2::signal to notify a dialog when the state of an underlying object has changed.
The signal is sometimes is generated at 100Hz. Other times it is generated at 1Hz. The dialog provides a "slot" for this signal that updates the controls on the screen. I'd like to limit the "slot rate" to 10Hz. By "slot rate" I mean the rate at which the slot receives notification from the signal. This will prevent the screen updates from happening faster than can be seen.
Has this been done already? If not, I'm going to implement something like the pseudocode below. Currently I'm not sure how I to specify "arguments" nor how I am going to specify the function "SlotCallback".
Hi, I don't think this exist in Boost. I would define instead a functor that takes care of the timing constraint. This functor could be use in other contexts, as Boost.Signal, or whatever library requesting callbacks. Best, Vicente