14
14
15
15
#if canImport(Darwin)
16
16
import Darwin
17
- #elseif canImport(Bionic )
18
- import Bionic
17
+ #elseif canImport(Android )
18
+ import Android
19
19
#elseif canImport(Glibc)
20
20
import Glibc
21
21
#elseif canImport(Musl)
@@ -24,12 +24,12 @@ import Musl
24
24
import WinSDK
25
25
#endif
26
26
27
- #if !(canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl) || canImport(WinSDK))
27
+ #if !(canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl) || canImport(WinSDK))
28
28
private var _globalTlsValue : UnsafeMutableRawPointer ?
29
29
#endif
30
30
31
31
package struct ThreadLocalStorage : ~ Copyable {
32
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
32
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
33
33
private typealias PlatformKey = pthread_key_t
34
34
#elseif canImport(WinSDK)
35
35
private typealias PlatformKey = DWORD
@@ -45,14 +45,14 @@ package struct ThreadLocalStorage: ~Copyable {
45
45
46
46
package typealias OnThreadExit = @convention ( c) ( _: Value ) -> ( )
47
47
48
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
48
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
49
49
private var _key : PlatformKey
50
50
#elseif canImport(WinSDK)
51
51
private let _key : PlatformKey
52
52
#endif
53
53
54
54
package init ( onThreadExit: OnThreadExit ) {
55
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
55
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
56
56
_key = 0
57
57
pthread_key_create ( & _key, onThreadExit)
58
58
#elseif canImport(WinSDK)
@@ -61,7 +61,7 @@ package struct ThreadLocalStorage: ~Copyable {
61
61
}
62
62
63
63
package func get( ) -> UnsafeMutableRawPointer ? {
64
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
64
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
65
65
pthread_getspecific ( _key)
66
66
#elseif canImport(WinSDK)
67
67
FlsGetValue ( _key)
@@ -71,7 +71,7 @@ package struct ThreadLocalStorage: ~Copyable {
71
71
}
72
72
73
73
package func set( _ value: Value ) {
74
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
74
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
75
75
pthread_setspecific ( _key, value)
76
76
#elseif canImport(WinSDK)
77
77
FlsSetValue ( _key, value)
@@ -81,7 +81,7 @@ package struct ThreadLocalStorage: ~Copyable {
81
81
}
82
82
83
83
deinit {
84
- #if canImport(Darwin) || canImport(Bionic ) || canImport(Glibc) || canImport(Musl)
84
+ #if canImport(Darwin) || canImport(Android ) || canImport(Glibc) || canImport(Musl)
85
85
pthread_key_delete ( _key)
86
86
#elseif canImport(WinSDK)
87
87
FlsFree ( _key)
0 commit comments