Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site proper.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!ihnp4!zehntel!dual!proper!geoff From: geoff@proper.UUCP (Geoff Kuenning) Newsgroups: net.unix,net.unix-wizards,net.flame Subject: Re: non-blocking read Message-ID: <985@proper.UUCP> Date: Tue, 7-Feb-84 05:33:34 EST Article-I.D.: proper.985 Posted: Tue Feb 7 05:33:34 1984 Date-Received: Fri, 10-Feb-84 02:25:21 EST References: <964@proper.UUCP> Organization: Proper UNIX, San Leandro, CA Lines: 22 A request was made on the net for information on how to do a non-blocking read from a terminal. Under 4BSD and UniSoft ports, the FIONREAD 'ioctl' can be used to check for characters, albeit at a high cost in CPU time. Other solutions have been posted to the net. A related question is how to do asynchronous disk I/O for purposes of double buffering. System V provides an open/fcntl option for non-blocking (read asynchronous) I/O, but there is a *VERY* nasty catch: there is no way to find out when the I/O is finished! This makes the non-blocking feature pretty useless. Indeed, when I examined the double-buffering code in "volcopy" to find out how they did it, I discovered that they fork a copy of themselves and then write "r" and "w" characters across pipes to synchronize the two copies. Each copy is responsible for working with one of the two buffers, and writes a single character to the other copy when the buffer is complete. YUCCCCCCH! KLUDGE KLUDGE KLUDGE! How about it, Bell Labs? If you are going to provide non-blocking I/O, I really think you should give us a way to find out when the I/O is complete. I fully realize the difficulty of integrating such a feature into the Unix design; but I still think you should do it the right way.