https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=95c5a3f6b7821366bec548844ab1bbd63737bf13
commit 95c5a3f6b7821366bec548844ab1bbd63737bf13 Author: Corinna Vinschen <[email protected]> Date: Mon Jun 15 16:15:37 2015 +0200 Don't enforce SA_RESTART in non-main threads * exceptions.cc (_cygtls::call_signal_handler): Disable enforcing SA_RESTART in non-main threads to allow returning with EINTR from system calls. Signed-off-by: Corinna Vinschen <[email protected]> Diff: --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/exceptions.cc | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8b6ed6a..1eafa28 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2015-06-15 Corinna Vinschen <[email protected]> + + * exceptions.cc (_cygtls::call_signal_handler): Disable enforcing + SA_RESTART in non-main threads to allow returning with EINTR from + system calls. + 2015-06-11 Corinna Vinschen <[email protected]> * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 5. diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 4a6c21e..7ecac23 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1542,7 +1542,12 @@ _cygtls::call_signal_handler () set_errno (this_errno); } - return this_sa_flags & SA_RESTART || (this != _main_tls); + /* FIXME: Since 2011 this return statement always returned 1 (meaning + SA_RESTART is effective) if the thread we're running in is not the + main thread. We're disabling this check to enable EINTR behaviour + on system calls not running in the main thread. It's not quite clear + if that has undesired side-effects, therefore this comment. */ + return this_sa_flags & SA_RESTART; } void
