| OLD | NEW |
| 1 //===- subzero/src/IceTLS.h - thread_local workaround -----------*- C++ -*-===// | 1 //===- subzero/src/IceTLS.h - thread_local workaround -----------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 /// |
| 10 // This file defines macros for working around the lack of support for | 10 /// \file |
| 11 // thread_local in MacOS 10.6. It assumes std::thread is written in | 11 /// This file defines macros for working around the lack of support for |
| 12 // terms of pthread. Define ICE_THREAD_LOCAL_HACK to enable the | 12 /// thread_local in MacOS 10.6. It assumes std::thread is written in |
| 13 // pthread workarounds. | 13 /// terms of pthread. Define ICE_THREAD_LOCAL_HACK to enable the |
| 14 // | 14 /// pthread workarounds. |
| 15 /// |
| 15 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
| 16 | 17 |
| 17 #ifndef SUBZERO_SRC_ICETLS_H | 18 #ifndef SUBZERO_SRC_ICETLS_H |
| 18 #define SUBZERO_SRC_ICETLS_H | 19 #define SUBZERO_SRC_ICETLS_H |
| 19 | 20 |
| 20 #if defined(_MSC_VER) | 21 #if defined(_MSC_VER) |
| 21 #define ICE_ATTRIBUTE_TLS __declspec(thread) | 22 #define ICE_ATTRIBUTE_TLS __declspec(thread) |
| 22 #else // !_MSC_VER | 23 #else // !_MSC_VER |
| 23 #define ICE_ATTRIBUTE_TLS thread_local | 24 #define ICE_ATTRIBUTE_TLS thread_local |
| 24 #endif // !_MSC_VER | 25 #endif // !_MSC_VER |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 static ICE_ATTRIBUTE_TLS Type FieldName | 92 static ICE_ATTRIBUTE_TLS Type FieldName |
| 92 #define ICE_TLS_DEFINE_FIELD(Type, ClassName, FieldName) \ | 93 #define ICE_TLS_DEFINE_FIELD(Type, ClassName, FieldName) \ |
| 93 ICE_ATTRIBUTE_TLS Type ClassName::FieldName = nullptr | 94 ICE_ATTRIBUTE_TLS Type ClassName::FieldName = nullptr |
| 94 #define ICE_TLS_INIT_FIELD(FieldName) | 95 #define ICE_TLS_INIT_FIELD(FieldName) |
| 95 #define ICE_TLS_GET_FIELD(FieldName) (FieldName) | 96 #define ICE_TLS_GET_FIELD(FieldName) (FieldName) |
| 96 #define ICE_TLS_SET_FIELD(FieldName, Value) (FieldName = (Value)) | 97 #define ICE_TLS_SET_FIELD(FieldName, Value) (FieldName = (Value)) |
| 97 | 98 |
| 98 #endif // !ICE_THREAD_LOCAL_HACK | 99 #endif // !ICE_THREAD_LOCAL_HACK |
| 99 | 100 |
| 100 #endif // SUBZERO_SRC_ICETLS_H | 101 #endif // SUBZERO_SRC_ICETLS_H |
| OLD | NEW |