11
11
12
12
import DequeModule
13
13
14
- extension AsyncSequence {
14
+ extension AsyncSequence where Self : Sendable , Element : Sendable {
15
15
16
16
/// Creates an asynchronous sequence that can be shared by multiple consumers.
17
17
///
@@ -54,7 +54,7 @@ extension AsyncSequence {
54
54
/// iterator when the connected consumer count falls to zero, its history will be discarded at the
55
55
/// same time.
56
56
public struct AsyncSharedSequence < Base: AsyncSequence >
57
- where Base : Sendable , Base. Element : Sendable , Base. AsyncIterator : Sendable {
57
+ where Base: Sendable , Base. Element : Sendable {
58
58
59
59
/// The iterator disposal policy applied by a shared asynchronous sequence to its upstream iterator
60
60
///
@@ -97,7 +97,7 @@ extension AsyncSharedSequence: AsyncSequence, Sendable {
97
97
98
98
public typealias Element = Base . Element
99
99
100
- public struct Iterator : AsyncIteratorProtocol , Sendable {
100
+ public struct Iterator : AsyncIteratorProtocol , Sendable where Base . Element : Sendable {
101
101
102
102
private let id : UInt
103
103
private let deallocToken : DeallocToken ?
@@ -194,9 +194,9 @@ fileprivate extension AsyncSharedSequence {
194
194
deinit { action ( ) }
195
195
}
196
196
197
- struct SharedUpstreamIterator {
197
+ struct SharedUpstreamIterator : Sendable {
198
198
199
- private enum State {
199
+ private enum State : @ unchecked Sendable {
200
200
case pending
201
201
case active( Base . AsyncIterator )
202
202
case terminal
@@ -207,7 +207,7 @@ fileprivate extension AsyncSharedSequence {
207
207
return true
208
208
}
209
209
210
- private let createIterator : ( ) -> Base . AsyncIterator
210
+ private let createIterator : @ Sendable ( ) -> Base . AsyncIterator
211
211
private var state = State . pending
212
212
213
213
init ( _ createIterator: @escaping @Sendable ( ) -> Base . AsyncIterator ) {
0 commit comments