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

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Wed Jul 11 03:18:45 PDT 2007


------- Comment #2 from gjcarneiro at gmail.com  2007-07-11 06:18 -------
Actually my Timer was inspired by the ns-2 one, but I could not understand how
differentiating between sched and resched has any use.  If I was programming
with these timers I would always call resched to make sure it always works. 
Slightly different semantics just adds a bit of extra complexity to the API and
I'm not sure there is any again.

Nor why status() is any use; perhaps a IsRunning () method could help, but
other than that...

In ns-2 resched is used about 250 times, vs about 90 times for sched.  And in
any case I would argue that in this code:

NS_ASSERT (!timer.IsRunning ());
timer.Schedule ();

the precondition that the timer must not be running is easier to read than when
it is hidden in this code:

timer.Schedule ();

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