Skip to content

Commit bc60a63

Browse files
committed
Ensure libdispatch is always initialized before CoreFoundation
This has been causing async functions to not return when using static linking. rdar://96642321
1 parent 0787ce6 commit bc60a63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,12 @@ void __CFInitialize(void) {
11751175
if (!__CFInitialized && !__CFInitializing) {
11761176
__CFInitializing = 1;
11771177

1178+
#if __HAS_DISPATCH__
1179+
// libdispatch has to be initialized before CoreFoundation, so to avoid
1180+
// issues with static initializer ordering, we are doing it explicitly.
1181+
libdispatch_init();
1182+
#endif
1183+
11781184
// This is a no-op on Darwin, but is needed on Linux and Windows.
11791185
_CFPerformDynamicInitOfOSRecursiveLock(&CFPlugInGlobalDataLock);
11801186

0 commit comments

Comments
 (0)