Skip to content

Commit 26d3fb9

Browse files
authored
Make NIOPosix strict-concurrency clean (#3090)
Motivation NIOPosix should be clean under strict concurrency Modifications - Fix newly-added issue in GetaddrinfoResolver - Fix newly-added issue in SEL - Lock in the win in Package.swift Result We did it!
1 parent 85742bc commit 26d3fb9

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ let package = Package(
120120
swiftAtomics,
121121
],
122122
exclude: includePrivacyManifest ? [] : ["PrivacyInfo.xcprivacy"],
123-
resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : []
123+
resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : [],
124+
swiftSettings: strictConcurrencySettings
124125
),
125126
.target(
126127
name: "NIO",

Sources/NIOPosix/GetaddrinfoResolver.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ internal final class GetaddrinfoResolver: Resolver, Sendable {
217217

218218
// Ensure that both futures are succeeded in the same tick
219219
// to avoid racing and potentially leaking a promise
220-
self.loop.execute {
220+
self.loop.execute { [v4Results, v6Results] in
221221
self.v6Future.succeed(v6Results)
222222
self.v4Future.succeed(v4Results)
223223
}

Sources/NIOPosix/SelectableEventLoop.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ internal final class SelectableEventLoop: EventLoop, @unchecked Sendable {
351351
id: self.scheduledTaskCounter.loadThenWrappingIncrement(ordering: .relaxed),
352352
{
353353
do {
354-
promise.succeed(try task())
354+
promise.assumeIsolatedUnsafeUnchecked().succeed(try task())
355355
} catch let err {
356356
promise.fail(err)
357357
}

0 commit comments

Comments
 (0)