Skip to content

Commit

Permalink
Merge pull request #29 from pbk20191/develop
Browse files Browse the repository at this point in the history
fix jobSequence to compile under swift 5.9
  • Loading branch information
pbk20191 authored Jun 28, 2023
2 parents 0571922 + c0c9c76 commit 215064f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/Tetra/AsyncScope/JobSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ struct JobSequence: Sendable, AsyncSequence {
private let continuation:AsyncStream<Element>.Continuation

init() {
#if swift(<5.9)
var continuation:AsyncStream<Element>.Continuation? = nil
let source = AsyncStream<Element>.init {
continuation = $0
}
let ref = continuation!
#else
let (source, ref) = AsyncStream<Element>.makeStream()
stream = source
continuation = ref
#endif
self.stream = source
self.continuation = ref
}

func append(job: __owned @escaping Element) -> Bool {
Expand Down

0 comments on commit 215064f

Please sign in to comment.