mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-01-19 04:42:12 +00:00
Enable usage of MSVC specific thread local storage attributes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user