[Ns-bugs] [Bug 46] A Timer class

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Tue Jul 10 21:28:56 PDT 2007


http://www.nsnam.org/bugzilla/show_bug.cgi?id=46





------- Comment #1 from tomh at tomh.org  2007-07-11 00:28 -------
I support adding a Timer class.  

Have you considered supporting the existing ns-2 API?:

        void sched(double delay);       // cannot be pending
        void resched(double delay);     // may or may not be pending
                                        // if you don't know the pending status
                                        // call resched()
        void cancel();                  // must be pending
        inline void force_cancel() {    // cancel!
                if (status_ == TIMER_PENDING) {
                        _cancel();
                        status_ = TIMER_IDLE;
                }        }
        enum TimerStatus { TIMER_IDLE, TIMER_PENDING, TIMER_HANDLING };
        int status() { return status_; };

The main difference is that an error is raised if you try to cancel() a
non-pending timer or schedule an already pending timer.  Having slightly
different semantics like that may catch some programming errors.


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list