Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP Newsgroups: comp.emacs Subject: Re: MicroEMACS works but eats CPU on SysV Message-ID: <6295@ncoast.UUCP> Date: Sat, 28-Nov-87 18:03:02 EST Article-I.D.: ncoast.6295 Posted: Sat Nov 28 18:03:02 1987 Date-Received: Tue, 1-Dec-87 05:09:12 EST References: <1107@sugar.UUCP> <422@cimcor.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.emacs Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 40 As quoted from <422@cimcor.UUCP> by mike@cimcor.UUCP (Michael Grenier): +--------------- | In article <1107@sugar.UUCP>, karl@sugar.UUCP (Karl Lehenbauer) writes: | > Anyway, emacs works just fine, but it totally eats CPU time (pretty | > much all that's available), even when it's just sitting there waiting for | > keys. Anybody know what's happening? I selected USG and Unix compiler, | > terminal output as termcap; the rest are defaults. I thought I'd ask | | Hmmm... it does seem to be doing something strange. It grabs all the | CPU time on my system as well (though at a low priority) in some | sort of system call. What's really strange is that version 3.8i which | I had installed patches for terminfo support consumes no time | when idle. Perhaps the question is, when will Daniel Lawrence | support System V Unix with terminfo instead/in addition to the | older termcap. | | Actually, its looping at line 431 in termio.c polling stdin. | I'm not a unix wizard so I don't understand why he special cased | USG from the V7/BSD version at this point. +--------------- Don't patch it blindly or you'll lose functionality. The reason it loops is that System V has a "non-blocking read", which allows the program to continue if nothing has been typed. At the least, I'd hazard a guess that it is used to interrupt a refresh when there is pending input. BSD has a better way (two, in fact): select() has the ability to check for input with an optional timeout, and ioctl(fd, FIONREAD, &c) places in the variable "c" the number of pending unread characters on file descriptor "fd". Xenix also has an alternative: rdchk(fd) is like BSD FIONREAD, but it returns its result rather than storing it in a variable, and it's designed (or *was* designed) to have an especially low overhead. V7 doesn't have *any* way of checking for input. As for termcap/terminfo: some people don't like terminfo. And even if they *do* use it, terminfo can be used in "termcap compatible" mode. -- Brandon S. Allbery necntc!ncoast!allbery@harvard.harvard.edu {hoptoad,harvard!necntc,cbosgd,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery Moderator of comp.sources.misc