1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> pcb-rnd rosetta timers </title>
<meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
</head>
<body>
<!-- ******* DO NOT EDIT THIS FILE, it is generated by rosetta_genpages.sh ******* -->
<-- back to the <a href="../index.html">index of Rosetta examples</a>
<h1>timers</h1>
Create timers that are going to call back an action in the background.
<H2> Example implementations </H2>
<a href="ex.awk">awk</a>
|
<a href="ex.lua">lua</a>
|
<a href="ex.pl">pl</a>
|
<a href="ex.py">py</a>
|
<a href="ex.tcl">tcl</a>
<h2> Explanation, step by step </h2>
Create a function
<i>timer_cb</i>
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.
<p> Different combination of timer initialization arguments for period and count (2nd and 3rd argument of addtimer()):
<p>
<table border=1 cellspacing=0>
<tr>
<th>period
<th> count
<th> effect
<tr>
<td> 0
<td> 1
<td> 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
<tr>
<td> 1.2
<td> 1
<td> call timer_cb once, in 1.2 sec from now
<tr>
<td> 0.5
<td> 3
<td> call timer_cb three times, with 0.5 sec in between </table>
<p> All timers start counting after a short period of time
<b>after</b>
the script's initialization finished. The three timers are kept track on separately.
</body>
</html>
|