Remove unchecked Sendable from NotificationListener - #663
Open
fabianfett wants to merge 2 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #663 +/- ##
==========================================
- Coverage 77.58% 77.56% -0.03%
==========================================
Files 137 137
Lines 10668 10702 +34
==========================================
+ Hits 8277 8301 +24
- Misses 2391 2401 +10
🚀 New features to boost your workflow:
|
gwynne
approved these changes
Aug 12, 2026
| switch self.state { | ||
| // The state may only be inspected on the EventLoop. If we are deinitialized somewhere else, | ||
| // we can't validate that the listener has been used correctly. | ||
| guard self.eventLoop.inEventLoop else { return } |
Member
There was a problem hiding this comment.
I take it this is something that can happen too easily for an assertion to be safe?
| break | ||
|
|
||
| @unknown default: | ||
| break |
Member
There was a problem hiding this comment.
Should we cancel for unknown termination reasons? Seems like the safer choice IMO.
| let id: Int | ||
|
|
||
| private var state: State | ||
| private let stateBox: NIOLoopBoundBox<State> |
Member
There was a problem hiding this comment.
Not a nit, just curiosity—how much overhead does NIOLoopBoundBox impose? My guess is not very much.
Collaborator
Author
There was a problem hiding this comment.
Mostly one additional alloc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
@unchecked Sendableis dangerousChanges
NIOLoopBoundBoxinNotificationListenerto show the compiler what is safeResult
One instance of
@unchecked Sendableless