Re: XForms: FL_TIMEOUT_CALLBACK not defined ?

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 1 Sep 98 21:14:39 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> To register a timeout callback, the following routine can be used
>
> typedef void (*FL_TIMEOUT_CALLBACK)(int, void *)
> int fl_add_timeout(long msec,
> FL_TIMEOUT_CALLBACK callback, void *data)
>
>
> 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?

> Also the manual fails to describe the parameters of
> the callback. I suppose that the first one is the
> ID returned by fl_add_timeout, and the second is "data" ?

Yes.

> By the way, I have another question related to timeout callback:
>
> 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.

Actually, there's really no way that the call can fail other than if
you run the process out of memory (unfortunately, as far as I can
tell, there's no check for this and the program will core dump).

spl

_________________________________________________
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/