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:
parent
4dd8dd654f
commit
33173bf4e5
2
CHANGES
2
CHANGES
@ -1,6 +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
|
||||
file-systems (STR #622)
|
||||
- FLUID didn't handle default function parameters
|
||||
|
@ -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.
|
||||
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 "TICK" 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&);</A></H4>
|
||||
|
||||
<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>
|
||||
|
||||
<P>Inside a timeout callback you can call this to add another timeout.
|
||||
Rather than the time being measured from "now", it is measured from
|
||||
when the system call elapsed that caused this timeout to be called. This
|
||||
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>This method repeats a timeout callback from the expiration of the
|
||||
previous timeout, allowing for more accurate timing. You may only call
|
||||
this method inside a timeout callback.
|
||||
|
||||
<p>It is undefined what this does if called from outside a timeout
|
||||
callback.
|
||||
<p>The following code will print "TICK" each second on
|
||||
<tt>stdout</tt> with a fair degree of accuracy:</p>
|
||||
|
||||
<P>This code will print "TICK" each second on stdout, with a
|
||||
fair degree of accuracy:
|
||||
<PRE>
|
||||
void callback(void*) {
|
||||
puts("TICK");
|
||||
Fl::repeat_timeout(1.0, callback);
|
||||
}
|
||||
|
||||
<UL><PRE>
|
||||
void callback(void*) {
|
||||
printf("TICK\n");
|
||||
Fl::repeat_timeout(1.0,callback);
|
||||
}
|
||||
|
||||
main() {
|
||||
Fl::add_timeout(1.0,callback);
|
||||
return Fl::run();
|
||||
}
|
||||
</PRE></UL>
|
||||
int main() {
|
||||
Fl::add_timeout(1.0, callback);
|
||||
return Fl::run();
|
||||
}
|
||||
</PRE>
|
||||
|
||||
<H4><A NAME="Fl.run">int run();</A></H4>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user