Skip to content

Commit f2c980c

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 61ec1fb + 84f625f commit f2c980c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

stdlib/public/stubs/ThreadLocalStorage.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ void _stdlib_destroyTLS(void *);
2323
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API
2424
void *_stdlib_createTLS(void);
2525

26-
#if defined(_WIN32) && !defined(__CYGWIN__)
27-
28-
typedef
29-
#if defined(_M_IX86)
30-
__stdcall
31-
#endif
32-
void (*__swift_thread_key_destructor)(void *);
33-
3426
static void
3527
#if defined(_M_IX86)
3628
__stdcall
@@ -39,6 +31,14 @@ destroyTLS_CCAdjustmentThunk(void *ptr) {
3931
_stdlib_destroyTLS(ptr);
4032
}
4133

34+
#if defined(_WIN32) && !defined(__CYGWIN__)
35+
36+
typedef
37+
#if defined(_M_IX86)
38+
__stdcall
39+
#endif
40+
void (*__swift_thread_key_destructor)(void *);
41+
4242
static inline int
4343
_stdlib_thread_key_create(__swift_thread_key_t * _Nonnull key,
4444
__swift_thread_key_destructor _Nullable destructor) {
@@ -83,9 +83,7 @@ _swift_stdlib_threadLocalStorageGet(void) {
8383
static __swift_thread_key_t key;
8484

8585
SWIFT_ONCE_F(token, [](void *) {
86-
int result = SWIFT_THREAD_KEY_CREATE(&key, [](void *pointer) {
87-
_stdlib_destroyTLS(pointer);
88-
});
86+
int result = SWIFT_THREAD_KEY_CREATE(&key, destroyTLS_CCAdjustmentThunk);
8987
if (result != 0)
9088
swift::fatalError(0, "couldn't create pthread key for stdlib TLS: %s\n",
9189
std::strerror(result));

0 commit comments

Comments
 (0)