next up previous contents index
Next: 10.3 Commands at a Up: 10. Timers Previous: 10.1.2 Example: Tcp retransmission

   
10.2 OTcl Timer class

A simple timer class is defined in tcl/mcast/timer.tcl. Subclasses of Timer can be defined as needed. Unlike the C++ timer API, where a []sched aborts if the timer is already set, []sched and []resched are the same; i.e., no state is kept for the OTcl timers. The following methods are defined in the Timer base class:

    $self sched $delay   # causes "$self timeout" to be called $delay seconds in the future;
    $self resched $delay # same as "$self sched $delay" ;
    $self cancel         # cancels any pending scheduled callback;
    $self destroy        # same as "$self cancel";
    $self expire         # calls "$self timeout" immediately;




2000-08-24