File tree Expand file tree Collapse file tree 2 files changed +23
-15
lines changed Expand file tree Collapse file tree 2 files changed +23
-15
lines changed Original file line number Diff line number Diff line change 28
28
#define NORETURN __attribute__ ((__noreturn__))
29
29
#endif
30
30
31
+ #if defined(SK_BUILD_FOR_IOS) && \
32
+ (!defined(__IPHONE_9_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
33
+ #define SKSL_USE_THREAD_LOCAL 0
34
+ #else
35
+ #define SKSL_USE_THREAD_LOCAL 1
36
+ #endif
37
+
31
38
using SKSL_INT = int32_t ;
32
39
using SKSL_FLOAT = float ;
33
40
Original file line number Diff line number Diff line change 7
7
8
8
#include " src/sksl/SkSLPool.h"
9
9
10
+ #include " src/sksl/SkSLDefines.h"
11
+
10
12
#define VLOG (...) // printf(__VA_ARGS__)
11
13
12
14
namespace SkSL {
13
15
14
- #if defined(SK_BUILD_FOR_IOS) && \
15
- (!defined(__IPHONE_9_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
16
+ #if SKSL_USE_THREAD_LOCAL
17
+
18
+ static thread_local MemoryPool* sMemPool = nullptr ;
19
+
20
+ static MemoryPool* get_thread_local_memory_pool () {
21
+ return sMemPool ;
22
+ }
23
+
24
+ static void set_thread_local_memory_pool (MemoryPool* memPool) {
25
+ sMemPool = memPool;
26
+ }
27
+
28
+ #else
16
29
17
30
#include < pthread.h>
18
31
@@ -36,19 +49,7 @@ static void set_thread_local_memory_pool(MemoryPool* poolData) {
36
49
pthread_setspecific (get_pthread_key (), poolData);
37
50
}
38
51
39
- #else
40
-
41
- static thread_local MemoryPool* sMemPool = nullptr ;
42
-
43
- static MemoryPool* get_thread_local_memory_pool () {
44
- return sMemPool ;
45
- }
46
-
47
- static void set_thread_local_memory_pool (MemoryPool* memPool) {
48
- sMemPool = memPool;
49
- }
50
-
51
- #endif
52
+ #endif // SKSL_USE_THREAD_LOCAL
52
53
53
54
Pool::~Pool () {
54
55
if (get_thread_local_memory_pool () == fMemPool .get ()) {
You can’t perform that action at this time.
0 commit comments