Skip to content

Conversation

akbashev
Copy link
Contributor

@akbashev akbashev commented Sep 25, 2025

Motivation:

Configuring cluster system on main actor (whoever needs this) using configuration closure init leads to compiler error Sending value of non-Sendable type '(inout ClusterSystemSettings) -> Void' risks causing data races.

Modifications:

As library already been updated to Swift 6 and ClusterSystemSettings is not used outside configuration closure — feels like marking closure as sending is more suitable than using Sendable conformance.

Result:

Additional information

There are other same type closures in the system, but as they're not exposed to outside world — will be fixed during refactoring.

@akbashev akbashev changed the title Mark setting configuration closure as sending Mark configuration setting closure as sending Sep 25, 2025
@ktoso ktoso added the 🔨 semver/patch No public API change. label Sep 26, 2025
@akbashev
Copy link
Contributor Author

akbashev commented Sep 26, 2025

hm, seems like CI now using 6.2 (swift62noble) and swift format slightly changed, had re-run formatting once with Swift 6.2 and pushed

Comment on lines +134 to +138
handleSignal:
@escaping @Sendable (
_ActorContext<Message>,
_Signal
) async throws -> _Behavior<Message>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift format change

Fix format check updated sample to swift 6 make v5 specific for package enabled strict memory safety back to just unwrapping optional let's just use simple formatted Date.now formatting fix
@akbashev akbashev force-pushed the fix-data-race-compiler-error branch from 37c903a to b6339e9 Compare October 13, 2025 09:57
Comment on lines +56 to +59
.iOS(.v17),
.macOS(.v15),
.tvOS(.v17),
.watchOS(.v10),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased to run on Mac

@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned with cluster system

Comment on lines -132 to +134
var buffer = [Int8](repeating: 0, count: 255)
var timestamp = time(nil)
let localTime = localtime(&timestamp)
// This format is pleasant to read in local sample apps:
strftime(&buffer, buffer.count, "%H:%M:%S", localTime)
// The usual full format is:
// strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime)
return buffer.withUnsafeBufferPointer {
$0.withMemoryRebound(to: CChar.self) {
String(cString: $0.baseAddress!)
}
}
Date.now.formatted(date: .omitted, time: .standard)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but seems like starting Swift 6.2 localtime(&timestamp) returns optional UnsafeMutablePointer? on Linux, while for Darwin it's UnsafeMutablePointer!
Guess simple date formatting will work here.

@akbashev
Copy link
Contributor Author

@ktoso there was ongoing issues with Dining philosophers sample test, fixed it.

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks

@ktoso ktoso merged commit 44cff54 into apple:main Oct 16, 2025
34 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

2 participants