From 44a22ad51baa6f27e27b89316b5c10aa0519fe20 Mon Sep 17 00:00:00 2001 From: Tony Parker Date: Tue, 30 Jul 2024 15:06:29 -0700 Subject: [PATCH] Make sure that the once used for Process is static, so not recreated for each setup (#5038) (cherry picked from commit 1ed5181c4d02cd2e2a90cd623e22bbd2c9a26e05) --- Sources/Foundation/Process.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Foundation/Process.swift b/Sources/Foundation/Process.swift index 7a49932004..ee35c23a33 100644 --- a/Sources/Foundation/Process.swift +++ b/Sources/Foundation/Process.swift @@ -226,9 +226,9 @@ private func quoteWindowsCommandLine(_ commandLine: [String]) -> String { #endif open class Process: NSObject, @unchecked Sendable { + static let once = Mutex(false) + private static func setup() { - let once = Mutex(false) - once.withLock { if !$0 { let thread = Thread {