Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give NIOLoopBoundBox a sending off-EL initialiser once compiler is ready #2754

Open
weissi opened this issue Jun 26, 2024 · 0 comments
Open

Comments

@weissi
Copy link
Member

weissi commented Jun 26, 2024

https://github.com/swiftlang/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md will be useful to construct NIOLoopBoundBox with a non-Sendable value off EL.

But the compiler isn't ready quite yet.

This is a followup for #2753 (which allows Sendable values)

#if compiler(>=6.0) // `sending` is >= 6.0
extension NIOLoopBoundBox {
    /// Initialise a ``NIOLoopBoundBox`` by `sending` (i.e. transferring) a value, validly callable off `eventLoop`.
    ///
    /// Contrary to ``init(_:eventLoop:)``, this method can be called off `eventLoop` because we are `sending` the value across the isolation domain.
    /// Because we're `sending` `value`, we just need to protect it against mutations (because nothing else can have access to it anymore).
    public static func makeBoxSendingValue(
        _ value: sending Value,
        as: Value.Type = Value.self,
        eventLoop: EventLoop
    ) -> NIOLoopBoundBox<Value> {
        ...
    }
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant