Skip to content

Commit

Permalink
ttyplot.c: Get signal handling delay below 300ms for Ctrl+C
Browse files Browse the repository at this point in the history
This is related to signal starvation with high pressure in stdin.
See the commit just before for more context.

Also not this part in `man 2 pselect`:
> Note that the timeout interval will be rounded up to the system
> clock granularity, and kernel scheduling delays mean that the
> blocking interval may overrun by a small amount.

So there is no guarantee for <=300ms.
  • Loading branch information
hartwork committed Nov 28, 2023
1 parent bd0d0cb commit ef364b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ttyplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ int main(int argc, char *argv[]) {
if (previous_parse_succeeded) {
timeout.tv_nsec = 0; // we may have more input pressing, let's not throttle it down
} else {
timeout.tv_nsec = 500 * 1000 * 1000; // <=500 milliseconds for a healthy clock display
timeout.tv_nsec = 200 * 1000 * 1000; // <=500 milliseconds for a healthy clock display
}
const int select_ret = pselect(select_nfds, &read_fds, NULL, NULL, &timeout, &empty_sigset);

Expand Down

0 comments on commit ef364b5

Please sign in to comment.