Need Non-Blocking Terminal Input Function For Berkeley 4.2

der Mouse mouse at mcgill-vision.UUCP
Tue Jan 28 09:18:35 AEST 1986


I missed the original, but what's wrong with using the non-blocking mode
already provided by the kernel?

int on = 1;
ioctl(fd,FIONBIO,&on);

then if you read() and there are no data available, the read will return
with  either  EOF or  error  (return value  <=  0)  and  errno  will  be
EWOULDBLOCK.
-- 
					der Mouse

USA: {ihnp4,decvax,akgua,etc}!utcsri!mcgill-vision!mouse
     philabs!micomvax!musocs!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
        mcvax!seismo!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse

Hacker: One who accidentally destroys /
Wizard: One who recovers it afterward



More information about the Comp.unix.wizards mailing list