Update the documentation for add_timeout().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3909 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2004-11-21 14:44:38 +00:00
parent 4dd8dd654f
commit 33173bf4e5
2 changed files with 39 additions and 23 deletions

View File

@ -1,6 +1,6 @@
CHANGES IN FLTK 1.1.6 CHANGES IN FLTK 1.1.6
- Documentation updates (STR #608) - Documentation updates (STR #552, STR #608)
- Fl_Sys_Menu_Bar didn't compile on case-sensitive - Fl_Sys_Menu_Bar didn't compile on case-sensitive
file-systems (STR #622) file-systems (STR #622)
- FLUID didn't handle default function parameters - FLUID didn't handle default function parameters

View File

@ -233,6 +233,29 @@ FLTK will not recursively call the idle callback.
<tt>Fl::wait()</tt> at <i>t</i> seconds after this function is called. <tt>Fl::wait()</tt> at <i>t</i> seconds after this function is called.
The optional <tt>void*</tt> argument is passed to the callback. The optional <tt>void*</tt> argument is passed to the callback.
<P>You can have multiple timeout callbacks. To remove an timeout
callback use <A
href="#Fl.remove_timeout"><tt>Fl::remove_timeout()</tt></A>.
<p>If you need more accurate, repeated timeouts, use <a
href='#Fl.repeat_timeout'><tt>Fl::repeat_timeout()</tt></a> to
reschedule the subsequent timeouts.</p>
<p>The following code will print &quot;TICK&quot; each second on
<tt>stdout</tt> with a fair degree of accuracy:</p>
<PRE>
void callback(void*) {
puts("TICK");
Fl::repeat_timeout(1.0, callback);
}
int main() {
Fl::add_timeout(1.0, callback);
return Fl::run();
}
</PRE>
<H4><A NAME="Fl.arg">int arg(int, char**, int&amp;);</A></H4> <H4><A NAME="Fl.arg">int arg(int, char**, int&amp;);</A></H4>
<P>Consume a single switch from <tt>argv</tt>, starting at word i. <P>Consume a single switch from <tt>argv</tt>, starting at word i.
@ -988,31 +1011,24 @@ callback that no longer exists.
<H4><A NAME="Fl.repeat_timeout">void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);</A></H4> <H4><A NAME="Fl.repeat_timeout">void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);</A></H4>
<P>Inside a timeout callback you can call this to add another timeout. <P>This method repeats a timeout callback from the expiration of the
Rather than the time being measured from "now", it is measured from previous timeout, allowing for more accurate timing. You may only call
when the system call elapsed that caused this timeout to be called. This this method inside a timeout callback.
will result in far more accurate spacing of the timeout callbacks, it
also has slightly less system call overhead. (It will also use all
your machine time if your timeout code and FLTK's overhead take more
than <i>t</i> seconds, as the real timeout will be reduced to zero).
<p>It is undefined what this does if called from outside a timeout <p>The following code will print &quot;TICK&quot; each second on
callback. <tt>stdout</tt> with a fair degree of accuracy:</p>
<P>This code will print &quot;TICK&quot; each second on stdout, with a <PRE>
fair degree of accuracy: void callback(void*) {
puts("TICK");
Fl::repeat_timeout(1.0, callback);
}
<UL><PRE> int main() {
void callback(void*) { Fl::add_timeout(1.0, callback);
printf(&quot;TICK\n&quot;); return Fl::run();
Fl::repeat_timeout(1.0,callback); }
} </PRE>
main() {
Fl::add_timeout(1.0,callback);
return Fl::run();
}
</PRE></UL>
<H4><A NAME="Fl.run">int run();</A></H4> <H4><A NAME="Fl.run">int run();</A></H4>