Skip to content

Commit

Permalink
Make NIOPosix strict-concurrency clean (#3090)
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
Lukasa authored Jan 27, 2025
1 parent 85742bc commit 26d3fb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ let package = Package(
swiftAtomics,
],
exclude: includePrivacyManifest ? [] : ["PrivacyInfo.xcprivacy"],
resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : []
resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : [],
swiftSettings: strictConcurrencySettings
),
.target(
name: "NIO",
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOPosix/GetaddrinfoResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ internal final class GetaddrinfoResolver: Resolver, Sendable {

// Ensure that both futures are succeeded in the same tick
// to avoid racing and potentially leaking a promise
self.loop.execute {
self.loop.execute { [v4Results, v6Results] in
self.v6Future.succeed(v6Results)
self.v4Future.succeed(v4Results)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOPosix/SelectableEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ internal final class SelectableEventLoop: EventLoop, @unchecked Sendable {
id: self.scheduledTaskCounter.loadThenWrappingIncrement(ordering: .relaxed),
{
do {
promise.succeed(try task())
promise.assumeIsolatedUnsafeUnchecked().succeed(try task())
} catch let err {
promise.fail(err)
}
Expand Down

0 comments on commit 26d3fb9

Please sign in to comment.