File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 27
27
// If we're using Clang, and Clang claims not to support thread_local,
28
28
// it must be because we're on a platform that doesn't support it.
29
29
// Use pthreads.
30
- #if __clang__ && !__has_feature(cxx_thread_local)
31
- #define SWIFT_EXCLUSIVITY_USE_THREADLOCAL 0
32
- #define SWIFT_EXCLUSIVITY_USE_PTHREAD_SPECIFIC 1
30
+ // Workaround: has_feature(cxx_thread_local) is wrong on two old Apple
31
+ // simulators. clang thinks thread_local works there, but it doesn't.
32
+ #if TARGET_OS_SIMULATOR && !TARGET_RT_64_BIT && \
33
+ ((TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000 ) || \
34
+ (TARGET_OS_WATCH && __WATCHOS_OS_VERSION_MIN_REQUIRED__ < 30000 ))
35
+ // 32-bit iOS 9 simulator or 32-bit watchOS 2 simulator - use pthreads
36
+ # define SWIFT_EXCLUSIVITY_USE_THREADLOCAL 0
37
+ # define SWIFT_EXCLUSIVITY_USE_PTHREAD_SPECIFIC 1
38
+ #elif __clang__ && !__has_feature(cxx_thread_local)
39
+ // clang without thread_local support - use pthreads
40
+ # define SWIFT_EXCLUSIVITY_USE_THREADLOCAL 0
41
+ # define SWIFT_EXCLUSIVITY_USE_PTHREAD_SPECIFIC 1
33
42
#else
34
- #define SWIFT_EXCLUSIVITY_USE_THREADLOCAL 1
35
- #define SWIFT_EXCLUSIVITY_USE_PTHREAD_SPECIFIC 0
43
+ // Use thread_local
44
+ # define SWIFT_EXCLUSIVITY_USE_THREADLOCAL 1
45
+ # define SWIFT_EXCLUSIVITY_USE_PTHREAD_SPECIFIC 0
36
46
#endif
37
47
38
48
#endif
You can’t perform that action at this time.
0 commit comments