Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CoreFoundation/Base.subproj/CFRuntime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ void __CFInitialize(void) {
if (!__CFInitialized && !__CFInitializing) {
__CFInitializing = 1;

#if __HAS_DISPATCH__
#if __HAS_DISPATCH__ && !TARGET_OS_MAC
// libdispatch has to be initialized before CoreFoundation, so to avoid
// issues with static initializer ordering, we are doing it explicitly.
libdispatch_init();
Expand Down
15 changes: 9 additions & 6 deletions Sources/Foundation/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1134,14 +1134,17 @@ open class Process: NSObject {
open func waitUntilExit() {
let runInterval = 0.05
let currentRunLoop = RunLoop.current
let checkRunLoop : () -> Bool = (currentRunLoop == self.runLoop)
? { currentRunLoop.run(mode: .default, before: Date(timeIntervalSinceNow: runInterval)) }
: { currentRunLoop.run(until: Date(timeIntervalSinceNow: runInterval)); return true }

// update .runLoop to allow early wakeup.
let runRunLoop : () -> Void = (currentRunLoop == self.runLoop)
? { currentRunLoop.run(mode: .default, before: Date(timeIntervalSinceNow: runInterval)) }
: { currentRunLoop.run(until: Date(timeIntervalSinceNow: runInterval)) }
// update .runLoop to allow early wakeup triggered by terminateRunLoop.
self.runLoop = currentRunLoop
while self.isRunning && checkRunLoop() {}


while self.isRunning {
runRunLoop()
}

self.runLoop = nil
self.runLoopSource = nil
}
Expand Down