Re: ncurses event loop



Wellu <kuumaliimamies@xxxxxxxxx> wrote:

To me this looks weird but that can be due to fact that this is my
first ncurses program :) Anyway.. Is this kind of programming as "bad"
as it looks? Let's say get_progress_info() function takes 10 ms to
respond. That means that CPU-usage would be 100% all the time which is
vey bad thing. Does getch() really sleep when no keypress is coming?

no - getch() will wait at most 10msec before returning.

If there's no keyboard activity that's 50% usage - assuming no other
processes need time (which would be unusual).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
.


Quantcast