I have the following code: class queue;
class queueStats : public TimerHandler { public: inline queueStats(Kqueue *q) : TimerHandler() { q_ = q; } private: virtual void expire(Event *); queue* q_; }; void queueStats::expire(Event*) { q_->collectStats(); resched(q_->restatTime()); } class queue : public Queue { public: queue(); void collectStats(); protected: queueStats *qs_; } queue::queue() : qs_(this) { qs->resched(STATS_COLLECT_TIME); } Now, my problem is two fold. Is this the correct way to setup a recurring timer? When I do it this way, The expire event gets called twice for each event which my code cannot handle at present. Why would the code get called twice? Do I need to set the event to some state prior to rescheduling it?