mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
runtime: correct _stdlib_thread_key_create
The mapping of the return value of the `FlsAlloc` was flipped resulting in the failure of the TLS key creation. The test suite would fail to generate the TLS key resulting in failures.
This commit is contained in:
@@ -90,7 +90,7 @@ static_assert(std::is_same<__swift_thread_key_t, DWORD>::value,
|
|||||||
|
|
||||||
# define SWIFT_THREAD_KEY_CREATE _stdlib_thread_key_create
|
# define SWIFT_THREAD_KEY_CREATE _stdlib_thread_key_create
|
||||||
# define SWIFT_THREAD_GETSPECIFIC FlsGetValue
|
# define SWIFT_THREAD_GETSPECIFIC FlsGetValue
|
||||||
# define SWIFT_THREAD_SETSPECIFIC(key, value) (FlsSetValue(key, value) == TRUE)
|
# define SWIFT_THREAD_SETSPECIFIC(key, value) (FlsSetValue(key, value) == FALSE)
|
||||||
|
|
||||||
# else
|
# else
|
||||||
// Otherwise use the pthread API.
|
// Otherwise use the pthread API.
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ static inline int
|
|||||||
_stdlib_thread_key_create(__swift_thread_key_t * _Nonnull key,
|
_stdlib_thread_key_create(__swift_thread_key_t * _Nonnull key,
|
||||||
__swift_thread_key_destructor _Nullable destructor) {
|
__swift_thread_key_destructor _Nullable destructor) {
|
||||||
*key = FlsAlloc(destroyTLS_CCAdjustmentThunk);
|
*key = FlsAlloc(destroyTLS_CCAdjustmentThunk);
|
||||||
return *key != FLS_OUT_OF_INDEXES;
|
if (*key == FLS_OUT_OF_INDEXES)
|
||||||
|
return GetLastError();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user