Skip to content

Conversation

@glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Apr 1, 2025

No description provided.

@glbrntt glbrntt added the semver/none No version bump required. label Apr 1, 2025

final class NIOLockBenchmark: Benchmark {
final class NIOLockBenchmark: Benchmark, @unchecked Sendable {
// mutable state is protected by the lock
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit but couldn't we wrap opsDone in a NIOLockedValueBox instead and remove the @unchecked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From a Sendable-cleanness perspective, yes. However, this is a benchmark for NIOLock, so using NIOLockedValueBox would somewhat defeat the point of the benchmark!

return channel.pipeline.addHandler(self.serverHandler)
channel.eventLoop.makeCompletedFuture {
let serverHandler = ServerHandler(connectionEstablishedPromise, eventLoop: channel.eventLoop)
promise.succeed(NIOLoopBound(serverHandler, eventLoop: channel.eventLoop))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this promise succeeded if adding the handler to the pipeline failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If adding the handler fails then the bootstrap will throw anyway so it doesn't really matter.


extension UDPBenchmark {
final class EchoHandler: ChannelInboundHandler {
final class EchoHandler: ChannelInboundHandler, Sendable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this to be Sendable if we have a SendableView?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The SendableView is on a different type.

@glbrntt glbrntt requested a review from gjcairo April 2, 2025 18:28
@glbrntt glbrntt enabled auto-merge (squash) April 7, 2025 13:47
@glbrntt glbrntt merged commit 4b7854d into apple:main Apr 7, 2025
39 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants