Enable usage of MSVC specific thread local storage attributes

This commit is contained in:
Antony Polukhin
2017-05-03 23:47:12 +03:00
parent 235226bdcc
commit ca4464d23c
2 changed files with 11 additions and 1 deletions

View File

@@ -4,13 +4,18 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
#include <cstring>
#include <windows.h>
#include "dbgeng.h"
int foo() {
#ifndef BOOST_NO_CXX11_THREAD_LOCAL
static thread_local int i = 0;
#else
static __declspec(thread) int i = 0;
#endif
return i;
}

View File

@@ -166,8 +166,13 @@ public:
static com_holder< ::IDebugSymbols>& get_thread_local_debug_inst() BOOST_NOEXCEPT {
// [class.mfct]: A static local variable or local type in a member function always refers to the same entity, whether
// or not the member function is inline.
#ifndef BOOST_NO_CXX11_THREAD_LOCAL
static thread_local boost::stacktrace::detail::com_global_initer com;
static thread_local com_holder< ::IDebugSymbols> idebug(com);
#else
static __declspec(thread) boost::stacktrace::detail::com_global_initer com;
static __declspec(thread) com_holder< ::IDebugSymbols> idebug(com);
#endif
if (!idebug.is_inited()) {
try_init_com(idebug, com);