Asynchronous I/O and SIGIO

John Knottenbelt johnny@tecc.co.uk
Mon Jul 27 04:08:00 GMT 1998


Hi

I've been trying to get asynchronous I/O going. I would like to be able to
receive SIGIO signals when a file descriptor becomes ready for reading or
writing.

I have had some success by performing an fcntl:

int flags = fcntl( fd, F_GETFL, 0 );
fcntl( fd, F_SETFL, flags | O_NONBLOCK | FASYNC );

and then subsequently an ioctl

int yesplease = 1;
ioctl( fd, FIOASYNC, &yesplease );

(I'll admit I don't really know what the argument to the FIOASYNC ioctl
has got to be :)) It seems the the FIOASYNC actually enables the SIGIO
signals.

I tried using the fcntl F_SETOWN, but that didn't seem to work at all.

Any way this seems to work quite well for sockets and gives me SIGIOs.
However, it does not give me a SIGIO when the other end of the socket is
closed, which is desirable.

I would also like to get some SIGIOs when standard input / output are
ready for reading/writing but the ioctl does not succeed on fd 0.

Has any one had similar experience or can offer any advice?

Thanks

Johnny

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list