Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
assumeIsolated()
methods on EventLoop
, `EventLoopPromis…
…e` and `EventLoopFuture` > All methods/types are currently `internal` so we don't have to bikeshed just yet but we can move forward to get `NIOCore` warning free under strict concurrency # Motivation Methods on the above types are often called from the same event loop; however, we cannot prove to the compiler that this is true so we had to mark many methods on those types with `@Sendable` or require the generic type to be `Sendable`. This leads to unnecessary usage of `NIOLoopBound` when instead we should just dynamically assert that we are on the event loop. @dnadoba opened a very similar PR #2228. # Modification This PR provides a method called `assumeIsolated()` on the three types that returns a type which re-declaration of all methods of the wrapped typed that have `Sendable` annotations. This new type is asserting at runtime that we are on the right event loop; hence, we don't need a `Sendable` value. # Result This PR makes it easier for our adopters to avoid newly introduced `Sendable` warnings
- Loading branch information