pcb-rnd rosetta timers

<-- back to the index of Rosetta examples

#### timers

Create timers that are going to call back an action in the background.

##### Example implementations

awk | bas | fawk | lua | pas | pl | py | tcl

##### Explanation, step by step

Create a function timer_cb that will be registered as an action. This is what the timer will execute. It only prints its arguments in the message log so it is easy to trace how it is called.

Different combination of timer initialization arguments for period and count (2nd and 3rd argument of addtimer()):

period | count | effect
--- | --- | ---
0 | 1 | call timer_cb once, but only after the script finished initialization (async); 0 means "0 seconds after the current script call returns" - but in practice this is a shortest non-zero time the timer system can do
1.2 | 1 | call timer_cb once, in 1.2 sec from now
0.5 | 3 | call timer_cb three times, with 0.5 sec in between

All timers start counting after a short period of time after the script's initialization finished. The three timers are kept track on separately.