Mail Archives: cygwin/2001/07/16/11:17:16
I'm having a problem setting stdin to non-blocking io. The read
always seems to block.
I've tried using both ioctl() and fcntl().
This program for example:
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
int main(void)
{
int val;
char buf[10];
val = 1;
ioctl(0, FIONBIO, &val);
read(0, buf, sizeof(buf));
return 0;
}
It should just return to the prompt directly without reading
anything, but it waits for the user to hit enter.
Doing this:
val = fcntl(sock, F_GETFL, 0);
fcntl(sock, F_SETFL, val|O_NONBLOCK);
Does just the same.
I'm doing this on win98 with cygwin 1.3.2.
I assume I have to do something else to get it working properly,
since other programs seem to be able to do it (like bash, vim,
...)
Kurt
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -