Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
6efb0cff
Commit
6efb0cff
authored
Nov 14, 2019
by
jamesge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Not define thread_local for scenarios with c++11 off
parent
11949fc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
19 deletions
+2
-19
thread_local.h
src/butil/thread_local.h
+2
-19
No files found.
src/butil/thread_local.h
View file @
6efb0cff
...
...
@@ -25,22 +25,6 @@
#include <cstddef> // NULL
#include "butil/macros.h"
// Provide thread_local keyword (for primitive types) before C++11
// DEPRECATED: define this keyword before C++11 might make the variable ABI
// incompatible between C++11 and C++03
#if !defined(thread_local) && \
(__cplusplus < 201103L || \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800)
// GCC supports thread_local keyword of C++11 since 4.8.0
#ifdef _MSC_VER
// WARNING: don't use this macro in C++03
#define thread_local __declspec(thread)
#else
// WARNING: don't use this macro in C++03
#define thread_local __thread
#endif // _MSC_VER
#endif
#ifdef _MSC_VER
#define BAIDU_THREAD_LOCAL __declspec(thread)
#else
...
...
@@ -58,9 +42,8 @@ template <typename T> inline T* get_thread_local();
// thread, fn will be called at program termination. Calling sequence is LIFO:
// last registered function will be called first. Duplication of functions
// are not checked. This function is often used for releasing thread-local
// resources declared with __thread (or thread_local defined in
// butil/thread_local.h) which is much faster than pthread_getspecific or
// boost::thread_specific_ptr.
// resources declared with __thread which is much faster than
// pthread_getspecific or boost::thread_specific_ptr.
// Returns 0 on success, -1 otherwise and errno is set.
int
thread_atexit
(
void
(
*
fn
)());
int
thread_atexit
(
void
(
*
fn
)(
void
*
),
void
*
arg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment