Skip to content
Merged
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
11 changes: 9 additions & 2 deletions Sources/AsyncQueue/CancellableQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import Foundation
#if canImport(FoundationEssentials)
Comment thread
lhoward marked this conversation as resolved.
import FoundationEssentials
#else
import Foundation
#endif
#if canImport(Dispatch)
import Dispatch
#endif

/// A queue wrapper that enables cancelling all currently executing and pending tasks.
///
Expand Down Expand Up @@ -398,7 +405,7 @@ private final class Lock<State>: @unchecked Sendable {

// MARK: Fileprivate

fileprivate func withLock<R>(_ body: @Sendable (inout State) throws -> R) rethrows -> R where R: Sendable {
fileprivate func withLock<R: Sendable>(_ body: @Sendable (inout State) throws -> R) rethrows -> R {
try lockQueue.sync {
try body(&unsafeValue)
}
Expand Down
Loading