You can install a keyloop function that will be repeatedly executed while ki() is waiting for input from the keyboard. The keyloop function can do a variety of tasks while you wait for keyboard input. One possible use is to note the time that waiting for input started and then use that time to later decide whether to time out of the loop. You can also read a serial or network port.
When a keyloop function is installed, ki() will execute an endless loop that consists of checking for a keystroke and, if not found, executing your keyloop function. This loop will continue while no keystroke is found in the keyboard buffer and while the keyloop function returns a 0. All Vermont Views processing functions that wait for user input, such as fm_proc(), mn_proc(), etc., will call your keyloop function while waiting for user input.
Exit from the loop will also occur when the keyloop function returns a non-zero value. ki() treats a non-zero value returned by the keyloop function as a valid keycode. Returning a non-zero value from your keyloop function will cause ki() to behave as though the user had pressed that key.
Using Keyloop Functions Efficiently