Re: XForms: FL_TIMEOUT_CALLBACK not defined ?

T.C. Zhao (tc_zhao@yahoo.com)
Sun, 6 Sep 1998 17:18:08 -0700 (PDT)

# To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

---Steve Lamont <spl@szechuan.ucsd.edu> wrote:
>
> # To subscribers of the xforms list from spl@szechuan.ucsd.edu
(Steve Lamont) :
>
> > To register a timeout callback, the following routine can be used
> > but the "forms.h" file that I got with my 0.88 version
> > does not define FL_TIMEOUT_CALLBACK, i.e.:
> >
> > typedef void (*FL_TIMEOUT_CALLBACK)(int, void *);
>
> Looks like an oversight. TC?
Yes, indeed.

> > Is it guaranteed that a particular ID value (presumably -1) is
> > NEVER returned by a successful fl_add_timeout ?
>
> The practical answer is yes, though pedantically, no.
>
> I say yes because the id is an int, starting at 1 and incrementing
> upwards. Thus you would never expect it to be less than 1. However,
> since a signed integer will wrap around to -(INT_MAX - 1) and
increment
> to zero, so if you make a zillions of calls to fl_add_timeout()
> (specifically, ( 2 * INT_MAX ) + 2) then things will wrap around.
Thanks for explaining it so clearly. Also your anwser got me thinking,
what happens if a program does make zillions of calls ? It turns out
that assuming a constant stream of 10msec timeouts one after another,
the ID'll wrap around in about 250days, should be good enough for most
if not all xforms based applications. In any case, I think
it's a good idea to guarantee 0 and -1 never be returned by
fl_add_timeout() so the application program can use these values
to mark invalid or expired timeouts in case some nuts (-:) do
make heavy use of timeouts and let the program run 250 days.

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at /cgi-bin/exit-to?http://mail.yahoo.com

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/