Files
swift-nio/scripts
Franz Busch 8a9a3b1db5 Introduce assumeIsolated() methods on EventLoop, EventLoopPromise and EventLoopFuture (#2657)
* Introduce `assumeIsolated()` methods on `EventLoop`, `EventLoopPromise` 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 https://github.com/apple/swift-nio/pull/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

* Review
2024-02-19 18:09:26 +00:00
..
2020-01-29 14:39:28 +00:00