-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call pselect
twice to not starve signal handling (alternative to #130)
#132
Conversation
ef364b5
to
b621831
Compare
This has a few issues:
|
@edgar-bonet I understand that this is one of the more controversial among the pull requests we had so far, and we don't have to rush this. Regarding your points:
Personally I would rather rebase #115 on top of this after #132 has been merged; the conflict resolution should be trivial, if it's not I would volunteer for the resolution.
Yes, a race condition that will cause up to ~200ms delay in handling of Ctrl+C compared to 20+ seconds on current
Yes, but so far I considered rendering at 5 fps acceptable, we can discus that or revert back to 500ms and be conscious about it. To summarize, at the moment all these combined seem minor to me when compared to non-functioning Ctrl+C. |
b621831
to
cd66c76
Compare
@edgar-bonet I have dropped the increase in painting rate now, it only now only adds the second call to pselect. That will help keeping Ctrl+C working even with high pressure and the race condition will cause a few milliseconds in delay at worst and not do any other damage. I believe this is ready to go, thanks for your feedback and consideration. |
@edgar-bonet I have extracted a function |
04f7fed
to
30622f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still has a race condition. But the window of vulnerability is small, so this will do for now. Will probably implement a race-free alternative another day.
@edgar-bonet perfect, thank you! 🙏 |
With both aggressive stdin input and signals coming in, `pselect` sometimes delays signal delivery for multiple seconds, to the point where even holding Ctrl+C down for seconds will not be successful in terminating the process. I have witnessed this symptom for a duration of 20+ seconds in practice. To reproduce: > # ./ttyplot < /dev/zero > [hold Ctrl+C or press repeatedly] > [see it take multiple seconds for the process to terminate (if at all)] Related: https://stackoverflow.com/questions/62315082/pselect-on-linux-does-not-deliver-signals-if-events-are-pending
30622f8
to
e94cecd
Compare
@edgar-bonet rebasing onto latest |
Alternative to #130.
With both aggressive stdin input and signals coming in,
pselect
sometimes delays signal delivery for multiple seconds, to the point where even holding Ctrl+C down for seconds will not be successful in terminating the process. I have witnessed this symptom for a duration of 20+ seconds in practice.To reproduce:
Related:
https://stackoverflow.com/questions/62315082/pselect-on-linux-does-not-deliver-signals-if-events-are-pending