diff options
| author | Shinichiro Hamaji <hamaji@google.com> | 2016-02-29 20:07:39 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <hamaji@google.com> | 2016-02-29 20:07:39 +0900 |
| commit | 505d0d2b02791d1ab86df0bfa9c8726ba32026f9 (patch) | |
| tree | cb2662f728c9eedcd378e6bffdfb437d8dd4d291 /thread_local.h | |
| parent | 086b17663573f0d2742c534885a787c6d98216b9 (diff) | |
Revert "Revert "Merge remote-tracking branch 'aosp/upstream'""
This reverts commit 086b17663573f0d2742c534885a787c6d98216b9.
Diffstat (limited to 'thread_local.h')
| -rw-r--r-- | thread_local.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/thread_local.h b/thread_local.h index 3bbf663..28b146a 100644 --- a/thread_local.h +++ b/thread_local.h @@ -39,6 +39,13 @@ #include "log.h" +#ifdef __linux__ + +#define DEFINE_THREAD_LOCAL(Type, name) thread_local Type name +#define TLS_REF(x) x + +#else + // Thread local storage implementation which uses pthread. // Note that DEFINE_THREAD_LOCAL creates a global variable just like // thread local storage based on __thread keyword. So we should not use @@ -88,4 +95,8 @@ class ThreadLocal { } \ ThreadLocal<Type, &name##_key, &name##_once> name; +#define TLS_REF(x) x.Ref() + +#endif + #endif // THREAD_LOCAL_H_ |
