From 804ac524891ead6aa70e27c093686b71391ea232 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Fri, 21 Apr 2017 11:28:10 -0300 Subject: [PATCH] add helper function to set 'interruptThrown' this fixes a linker failure on cygwin 64 due to some bad interaction between tls and shared libraries. see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697 --- src/libmain/shared.cc | 2 +- src/libutil/util.cc | 7 ++++++- src/libutil/util.hh | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 4747b9bf9..d6c1c0c9c 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -259,7 +259,7 @@ int handleExceptions(const string & programName, std::function fun) condition is discharged before we reach printMsg() below, since otherwise it will throw an (uncaught) exception. */ - interruptThrown = true; + setInterruptThrown(); throw; } } catch (Exit & e) { diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 37dfccd06..88a2f752c 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -946,7 +946,12 @@ void closeOnExec(int fd) bool _isInterrupted = false; -thread_local bool interruptThrown = false; +static thread_local bool interruptThrown = false; + +void setInterruptThrown() +{ + interruptThrown = true; +} void _interrupted() { diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 121423cda..ae40dcd4c 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -267,7 +267,7 @@ void closeOnExec(int fd); extern bool _isInterrupted; -extern thread_local bool interruptThrown; +void setInterruptThrown(); void _interrupted();