fl_remove_io_callback

Stephen Langer (langer@cam.nist.gov)
Wed, 29 Jan 1997 15:02:29 -0500

To subscribers of the xforms list from "Stephen Langer" <langer@cam.nist.gov> :

Hi --

I'm having some trouble with fl_add_io_callback and fl_remove_io_callback.

My program opens a data file with
FILE *datafile = fopen("datafile", "r");
fl_add_io_callback(fileno(datafile), FL_READ, iocallback, 0);

and after it has detected eof it closes the file with
fl_remove_io_callback(fileno(datafile), FL_READ, iocallback);
fclose(datafile);

There are two problems:

After I close the file, my program slows down tremendously. The
debugger says that it's spending all of its time in _select. If I
don't call fl_remove_io_callback, the program does not slow down.

On the other hand, if I don't remove the callback, even after the
program reaches eof, the callback is still called. Isn't it only
supposed to be called if there is data available? But in this case
the program doesn't start spending lots of extra time in _select.

I thought perhaps that I wasn't supposed to call
fl_remove_io_callback from within the callback routine itself, but
after jumping through some hoops to put the call in a less convenient
spot, it didn't make any difference.

Thanks for the help. I'm using xforms 0.81 on an SGI, running IRIX 6.2,
32 bit ABI.

-- Steve

-- 
-- EMail: stephen.langer@nist.gov                    Phone: (301) 975-5423 --
-- WWW:  http://math.nist.gov/acmd/Staff/SLanger/    Fax:   (301) 990-4127 --
-- Mail: Building 820 Room 365; NIST; Gaithersburg, Md          20899-0001 --
_________________________________________________
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/