aboutsummaryrefslogtreecommitdiff
path: root/butl/utility
diff options
context:
space:
mode:
Diffstat (limited to 'butl/utility')
-rw-r--r--butl/utility18
1 files changed, 14 insertions, 4 deletions
diff --git a/butl/utility b/butl/utility
index 02d9331..b290153 100644
--- a/butl/utility
+++ b/butl/utility
@@ -188,14 +188,24 @@ namespace butl
// True means we are in the body of a destructor that is being called as
// part of the exception stack unwindining.
//
- LIBBUTL_EXPORT
extern
#ifdef BUTL_CXX11_THREAD_LOCAL
thread_local
#else
__thread
#endif
- bool exception_unwinding_dtor;
+ bool exception_unwinding_dtor_;
+
+ // On Windows one cannot export a thread-local variable so we have to
+ // use a wrapper functions.
+ //
+#ifdef _WIN32
+ LIBBUTL_EXPORT bool&
+ exception_unwinding_dtor ();
+#else
+ inline bool&
+ exception_unwinding_dtor () {return exception_unwinding_dtor_;}
+#endif
template <typename F>
struct exception_guard
@@ -205,9 +215,9 @@ namespace butl
{
if (std::uncaught_exception ())
{
- exception_unwinding_dtor = true;
+ exception_unwinding_dtor () = true;
f_ ();
- exception_unwinding_dtor = false;
+ exception_unwinding_dtor () = false;
}
}