Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Sources/NIOCore/AsyncChannel/AsyncChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,18 @@ public struct NIOAsyncChannel<Inbound: Sendable, Outbound: Sendable>: Sendable {
}

#if compiler(>=6.0)
// Note: Whitespace changes are used to workaround compiler bug
// Remove when compiler version 5.10 is no longer supported.
// https://github.com/swiftlang/swift/issues/79285
// swift-format-ignore
/// Provides scoped access to the inbound and outbound side of the underlying ``Channel``.
///
/// - Important: After this method returned the underlying ``Channel`` will be closed.
///
/// - Parameters:
/// - actor: actor where this function should be isolated to
/// - body: A closure that gets scoped access to the inbound and outbound.
public func executeThenClose<Result>(
isolation actor: isolated (any Actor)? = #isolation,
_ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>, _ outbound: NIOAsyncChannelOutboundWriter<Outbound>)
async throws -> sending Result
) async throws -> sending Result {
public func executeThenClose<Result>(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>, _ outbound: NIOAsyncChannelOutboundWriter<Outbound>) async throws -> sending Result) async throws -> sending Result {
let result: Result
do {
result = try await body(self._inbound, self._outbound)
Expand Down Expand Up @@ -420,17 +420,18 @@ extension NIOAsyncChannel {
}

#if compiler(>=6.0)
// Note: Whitespace changes are used to workaround compiler bug
// Remove when compiler version 5.10 is no longer supported.
// https://github.com/swiftlang/swift/issues/79285
// swift-format-ignore
/// Provides scoped access to the inbound side of the underlying ``Channel``.
///
/// - Important: After this method returned the underlying ``Channel`` will be closed.
///
/// - Parameters:
/// - actor: actor where this function should be isolated to
/// - body: A closure that gets scoped access to the inbound.
public func executeThenClose<Result>(
isolation actor: isolated (any Actor)? = #isolation,
_ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>) async throws -> sending Result
) async throws -> sending Result where Outbound == Never {
public func executeThenClose<Result>(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>) async throws -> sending Result) async throws -> sending Result where Outbound == Never {
let result: Result
do {
result = try await body(self._inbound)
Expand Down
10 changes: 5 additions & 5 deletions Sources/NIOCore/NIOLoopBound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ public final class NIOLoopBoundBox<Value>: @unchecked Sendable {
}

#if compiler(>=6.0)
// Note: Whitespace changes are used to workaround compiler bug
// Remove when compiler version 5.10 is no longer supported.
// https://github.com/swiftlang/swift/issues/79285
// swift-format-ignore
/// Initialise a ``NIOLoopBoundBox`` by sending a value, validly callable off `eventLoop`.
///
/// Contrary to ``init(_:eventLoop:)``, this method can be called off `eventLoop` because `value` is moved into the box and can no longer be accessed outside the box.
/// So we don't need to protect `value` itself, we just need to protect the ``NIOLoopBoundBox`` against mutations which we do because the ``value``
/// accessors are checking that we're on `eventLoop`.
public static func makeBoxSendingValue(
_ value: sending Value,
as: Value.Type = Value.self,
eventLoop: EventLoop
) -> NIOLoopBoundBox<Value> {
public static func makeBoxSendingValue(_ value: sending Value, as: Value.Type = Value.self, eventLoop: EventLoop) -> NIOLoopBoundBox<Value> {
// Here, we -- possibly surprisingly -- do not precondition being on the EventLoop. This is okay for a few
// reasons:
// - This function takes its value as `sending` so we don't need to worry about somebody
Expand Down
Loading