From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16428 invoked from network); 18 Oct 2000 16:44:54 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Oct 2000 16:44:54 -0000 Received: (qmail 3603 invoked by alias); 18 Oct 2000 16:44:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13030 Received: (qmail 3596 invoked from network); 18 Oct 2000 16:44:48 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: "Zsh hackers list" Subject: RE: PATCH: ptyread eating CPU on Cygwin Date: Wed, 18 Oct 2000 20:44:44 +0400 Message-ID: <001101c03922$b8381b90$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-reply-To: <1001018155547.ZM4463@candle.brasslantern.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal > > I'm not Sven, but HAVE_SELECT does not imply having FD_ZERO or an fd_set > typedef. > > On the other hand, I've just noticed that other code assumes in several > places that it does imply those things, so it's probably OK. > Yes, it was just copy'n'paste. > However, using a NULL timeout structure in the select() call has turned a > non-blocking read into a fully blocking one. If you're going to do that, > you might as well throw out the select() call and just set the descriptor > back to blocking state before calling read(). I suspect there's a good > reason it was a non-blocking read in the first place, though. > Erm. You are right, of course. Non-blocking read made sense in initial implemetation, because it was the condition to exit read loop (without pattern matching) - 9390: + do { + while ((ret = read(cmd->fd, buf + used, 1)) == 1) { + if (++used == blen) { + buf = hrealloc(buf, blen, blen << 1); + blen <<= 1; + } + } + buf[used] = '\0'; + } while (prog && !pattry(prog, buf)); Currently zsh tries to always read the whole input (until EOF) Actually, in pattern-matching mode it even completely ignores EOF. That makes absolutely no functional difference between blocking and non-blocking mode but makes performance in non-blocking mode terrible. As it stands now, we really can just use blocking read. -andrej