[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


------- 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) {
                        status_ = TIMER_IDLE;
                }        }
        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