提交 c1fbf91b 编写于 作者: T Tomas Kolda 提交者: Facebook Github Bot

Fixing Solaris Sparc crash due to cached TLS

Summary:
Workaround for Solaris gcc binary. Program is crashing, because when TLS of perf context that is used twice on same frame, it is damaged thus Segmentation fault.

Issue: #2153
Closes https://github.com/facebook/rocksdb/pull/2187

Differential Revision: D4922274

Pulled By: siying

fbshipit-source-id: 549105ebce9a8ce08a737f4d6b9f2312ebcde9a8
上级 963eeba4
......@@ -155,7 +155,12 @@ extern PerfContext perf_context;
#elif defined(_MSC_VER)
extern __declspec(thread) PerfContext perf_context;
#else
extern __thread PerfContext perf_context;
#if defined(OS_SOLARIS)
PerfContext *getPerfContext();
#define perf_context (*getPerfContext())
#else
extern __thread PerfContext perf_context;
#endif
#endif
}
......
......@@ -14,7 +14,11 @@ namespace rocksdb {
#elif defined(_MSC_VER)
__declspec(thread) PerfContext perf_context;
#else
__thread PerfContext perf_context;
#if defined(OS_SOLARIS)
__thread PerfContext perf_context_;
#else
__thread PerfContext perf_context;
#endif
#endif
void PerfContext::Reset() {
......@@ -162,4 +166,10 @@ std::string PerfContext::ToString(bool exclude_zero_counters) const {
#endif
}
#if defined(OS_SOLARIS)
PerfContext *getPerfContext() {
return &perf_context_;
}
#endif
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册