Fun and probably cryptic but libevent + curses thing in C.
I am using libevent with timed events
to make my curses program be dynamic.
I was noticing that I could go down to low microsecond
values and I my display was still only "ticking"
like maybe half a second or at the fastest a tenth
of a second.
And what I found is I was using the timeout(3000);
call in the curses setup. This makes getch() not block.
getch() is how curses takes user input.
As usual in hindsight this was what was effectively
defining the lowest resplution tick possible.
That timeout() means that getch() will wait that
long to see if a user has typed something.
(basically) ... wait is the same as saying it blocks
for that long.
long story short if I lowered the timeout to like 30
like timeout(30); then my ticks started blinking
really fast :)
See the events have nothing to do with user input.
They are just timed events that repeat.
But the whenever i called getch() it would
effectively block for that 3000 milliseconds *
TLDR: I can have the frames per second of my curses
code be "really fast" now.
* I just looked it up while typing this.
man 3 timeout. The parameter is milliseconds.
#curses #libevent #c