| 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 /// \file | 10 /// \file |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // defining C::F, we create two static fields: | 59 // defining C::F, we create two static fields: |
| 60 // static pthread_key_t F__key; | 60 // static pthread_key_t F__key; |
| 61 // static int F__initStatus; | 61 // static int F__initStatus; |
| 62 // | 62 // |
| 63 // The F__initStatus field is used to hold the result of the | 63 // The F__initStatus field is used to hold the result of the |
| 64 // pthread_key_create() call, where a zero value indicates success, and a | 64 // pthread_key_create() call, where a zero value indicates success, and a |
| 65 // nonzero value indicates failure or that ICE_TLS_INIT_FIELD() was never | 65 // nonzero value indicates failure or that ICE_TLS_INIT_FIELD() was never |
| 66 // called. The F__key field is used as the argument to pthread_getspecific() | 66 // called. The F__key field is used as the argument to pthread_getspecific() |
| 67 // and pthread_setspecific(). | 67 // and pthread_setspecific(). |
| 68 | 68 |
| 69 #include "llvm/Support/ErrorHandling.h" |
| 70 |
| 69 #include <pthread.h> | 71 #include <pthread.h> |
| 70 | 72 |
| 71 #define ICE_TLS_DECLARE_FIELD(Type, FieldName) \ | 73 #define ICE_TLS_DECLARE_FIELD(Type, FieldName) \ |
| 72 using FieldName##__type = Type; \ | 74 using FieldName##__type = Type; \ |
| 73 static pthread_key_t FieldName##__key; \ | 75 static pthread_key_t FieldName##__key; \ |
| 74 static int FieldName##__initStatus | 76 static int FieldName##__initStatus |
| 75 #define ICE_TLS_DEFINE_FIELD(Type, ClassName, FieldName) \ | 77 #define ICE_TLS_DEFINE_FIELD(Type, ClassName, FieldName) \ |
| 76 pthread_key_t ClassName::FieldName##__key; \ | 78 pthread_key_t ClassName::FieldName##__key; \ |
| 77 int ClassName::FieldName##__initStatus = 1 | 79 int ClassName::FieldName##__initStatus = 1 |
| 78 #define ICE_TLS_INIT_FIELD(FieldName) \ | 80 #define ICE_TLS_INIT_FIELD(FieldName) \ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 #define ICE_TLS_GET_FIELD(FieldName) (FieldName) | 106 #define ICE_TLS_GET_FIELD(FieldName) (FieldName) |
| 105 #define ICE_TLS_SET_FIELD(FieldName, Value) (FieldName = (Value)) | 107 #define ICE_TLS_SET_FIELD(FieldName, Value) (FieldName = (Value)) |
| 106 | 108 |
| 107 #endif // !ICE_THREAD_LOCAL_HACK | 109 #endif // !ICE_THREAD_LOCAL_HACK |
| 108 | 110 |
| 109 /// | 111 /// |
| 110 /// @} | 112 /// @} |
| 111 /// | 113 /// |
| 112 | 114 |
| 113 #endif // SUBZERO_SRC_ICETLS_H | 115 #endif // SUBZERO_SRC_ICETLS_H |
| OLD | NEW |