Re: fl_remove_io_callback

Dr. T.C. Zhao (zhao@bragg.phys.uwm.edu)
Thu, 30 Jan 1997 14:58:02 -0600

To subscribers of the xforms list from "Dr. T.C. Zhao" <zhao@bragg.phys.uwm.edu> :

From: "Stephen Langer" <langer@cam.nist.gov>
>(1) the free object isn't updated on schedule unless there's an io callback
>routine installed, and (2) the io callback routine is called even when there's
>no data waiting to be read.
Thanks for attaching sample code.

All your problem is caused by the use of clock. clock() returns the
amount of CPU time *USED*, not the elapsed time. If your program is
sitting idle, clock() should pretty much stay the same, i.e., return the
same number every time. This explains "the slowness" of the update.
If you look more carefully, you should see that FL_STEP is generated
regularly, it is the check (clock() - lastclock) that fails because
there is little CPU usage. Change the clock() routine
to time or gettimeofday or something similar from which
the elapsed time can be derived, everything should work as expected.

Removing io callback when EOF is seen is the right thing to do.
As mentioned above, the observed "problem" does not really have
anything to do with having or removing IO callbacks.

select does not work properly at/past EOF for regular files.
(it works properly for pipes etc.) I think this is not any
particular vendor's problem, it's a problem in all unix select.
I think I mentioned this in the document somewhere.

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