File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,11 @@ func spawnExecutable(
150
150
// these file descriptors.
151
151
_ = swt_posix_spawn_file_actions_addclosefrom_np ( fileActions, highestFD + 1 )
152
152
#elseif os(FreeBSD)
153
- // Like Linux, this platfrom doesn't have POSIX_SPAWN_CLOEXEC_DEFAULT;
154
- // However; unlike Linux, all non-EOL FreeBSD (>= 13.1) supports
155
- // `posix_spawn_file_actions_addclosefrom_np` and therefore we don't need
156
- // need `swt_posix_spawn_file_actions_addclosefrom_np` to guard the availability
157
- // of this api .
153
+ // Like Linux, this platform doesn't have POSIX_SPAWN_CLOEXEC_DEFAULT.
154
+ // Unlike Linux, all non-EOL FreeBSD versions (≥ 13.1) support
155
+ // `posix_spawn_file_actions_addclosefrom_np`. Therefore, we don't need
156
+ // `swt_posix_spawn_file_actions_addclosefrom_np` to guard the
157
+ // availability of this function .
158
158
_ = posix_spawn_file_actions_addclosefrom_np ( fileActions, highestFD + 1 )
159
159
#else
160
160
#warning("Platform-specific implementation missing: cannot close unused file descriptors")
Original file line number Diff line number Diff line change @@ -85,11 +85,11 @@ private let _childProcessContinuations = Locked<[pid_t: CheckedContinuation<Exit
85
85
/// A condition variable used to suspend the waiter thread created by
86
86
/// `_createWaitThread()` when there are no child processes to await.
87
87
private nonisolated ( unsafe) let _waitThreadNoChildrenCondition = {
88
- #if os(FreeBSD)
88
+ #if os(FreeBSD)
89
89
let result = UnsafeMutablePointer< pthread_cond_t?> . allocate( capacity: 1 )
90
- #else
90
+ #else
91
91
let result = UnsafeMutablePointer< pthread_cond_t> . allocate( capacity: 1 )
92
- #endif
92
+ #endif
93
93
_ = pthread_cond_init ( result, nil )
94
94
return result
95
95
} ( )
@@ -126,7 +126,7 @@ private let _createWaitThread: Void = {
126
126
// newly-scheduled waiter process. (If this condition is spuriously
127
127
// woken, we'll just loop again, which is fine.) Note that we read errno
128
128
// outside the lock in case acquiring the lock perturbs it.
129
- _childProcessContinuations. withUnsafeUnderlyingLock { lock, childProcessContinuations in
129
+ _childProcessContinuations. withUnsafePlatformLock { lock, childProcessContinuations in
130
130
if childProcessContinuations. isEmpty {
131
131
_ = pthread_cond_wait ( _waitThreadNoChildrenCondition, lock)
132
132
}
Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ struct Locked<T>: RawRepresentable, Sendable where T: Sendable {
123
123
}
124
124
}
125
125
126
- #if SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD) || os(Android) || (os(WASI) && compiler(>=6.1) && _runtime(_multithreaded))
127
126
/// Acquire the lock and invoke a function while it is held, yielding both the
128
127
/// protected value and a reference to the lock itself.
129
128
///
@@ -144,14 +143,13 @@ struct Locked<T>: RawRepresentable, Sendable where T: Sendable {
144
143
/// - Warning: Callers that unlock the lock _must_ lock it again before the
145
144
/// closure returns. If the lock is not acquired when `body` returns, the
146
145
/// effect is undefined.
147
- nonmutating func withUnsafeUnderlyingLock < R> ( _ body: ( UnsafeMutablePointer < PlatformLock > , T ) throws -> R ) rethrows -> R {
146
+ nonmutating func withUnsafePlatformLock < R> ( _ body: ( UnsafeMutablePointer < PlatformLock > , T ) throws -> R ) rethrows -> R {
148
147
try withLock { value in
149
148
try _storage. withUnsafeMutablePointerToElements { lock in
150
149
try body ( lock, value)
151
150
}
152
151
}
153
152
}
154
- #endif
155
153
}
156
154
157
155
extension Locked where T: AdditiveArithmetic {
You can’t perform that action at this time.
0 commit comments