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
Signal handler API has no way to set SA_RESTART #646
Comments
@nomis commented on Nov 3, 2018, 10:33 AM UTC: I'm going to workaround this by using I'm not convinced that the |
@nomis commented on Nov 4, 2018, 8:10 PM UTC: It's a bit fragile to wrap It would be a lot easier if asio could be configured to use |
For |
The user doesn't have control over 3rd party library code that he uses in his project. If any code forgets to make use of a macro such as TEMP_FAILURE_RETRY() in *any* syscall, we have a bug. Signals that interrupt syscalls are a bad default and BSD acknowledged that problem when it changed the default signal semantics to SA_RESTART way back at the release of 4.2BSD. POSIX upstreamed this option through the use of SA_RESTART, and ASIO should be making use of this flag by default (hence this commit). If any code wants the old behavior, it can opt-out of the new default by defining the macro ASIO_NO_SET_SA_RESTART. SA_RESTART is only meaningful when we establish a signal handler (asio_signal_handler), so we skip SA_RESTART altogether when sa_handler is set to any other value (SIG_DFL). Fixes chriskohlhoff#646
This is now fixed in Asio 1.27.0 / Boost 1.82.0 but I can't close it because GitHub has set the reporter to @ghost instead of me. |
@nomis commented on Oct 29, 2018, 8:14 PM UTC:
I'm handling SIGCHLD using asio while also doing writes to standard output and reads/writes to files.
If I receive SIGCHLD during a
read()
orwrite()
then it gets interrupted. The simplest way to deal with this is to setSA_RESTART
when setting up the signal handler, but there is no support for doing this and it doesn't happen by default.This issue was moved by chriskohlhoff from boostorg/asio#157.
The text was updated successfully, but these errors were encountered: