@@ -16,14 +16,18 @@ import Swift
16
16
@available ( SwiftStdlib 5 . 1 , * )
17
17
public protocol Executor : AnyObject , Sendable {
18
18
19
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
19
20
@available ( macOS, introduced: 10.15 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
20
21
@available ( iOS, introduced: 13.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
21
22
@available ( watchOS, introduced: 6.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
22
23
@available ( tvOS, introduced: 13.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
24
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
23
25
func enqueue( _ job: UnownedJob )
24
26
27
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
25
28
@available ( SwiftStdlib 5 . 9 , * )
26
29
func enqueue( _ job: __owned Job)
30
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
27
31
}
28
32
29
33
/// A service that executes jobs.
@@ -34,26 +38,31 @@ public protocol SerialExecutor: Executor {
34
38
// avoid drilling down to the base conformance just for the basic
35
39
// work-scheduling operation.
36
40
@_nonoverride
41
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
37
42
@available ( macOS, introduced: 10.15 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
38
43
@available ( iOS, introduced: 13.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
39
44
@available ( watchOS, introduced: 6.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
40
45
@available ( tvOS, introduced: 13.0 , deprecated: 9999 , message: " Implement 'enqueue(_: __owned Job)' instead " )
46
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
41
47
func enqueue( _ job: UnownedJob )
42
48
49
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
43
50
// This requirement is repeated here as a non-override so that we
44
51
// get a redundant witness-table entry for it. This allows us to
45
52
// avoid drilling down to the base conformance just for the basic
46
53
// work-scheduling operation.
47
54
@_nonoverride
48
55
@available ( SwiftStdlib 5 . 9 , * )
49
56
func enqueue( _ job: __owned Job)
57
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
50
58
51
59
/// Convert this executor value to the optimized form of borrowed
52
60
/// executor references.
53
61
@available ( SwiftStdlib 5 . 9 , * )
54
62
func asUnownedSerialExecutor( ) -> UnownedSerialExecutor
55
63
}
56
64
65
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
57
66
@available ( SwiftStdlib 5 . 9 , * )
58
67
extension Executor {
59
68
public func enqueue( _ job: UnownedJob ) {
@@ -64,6 +73,7 @@ extension Executor {
64
73
self . enqueue ( UnownedJob ( job) )
65
74
}
66
75
}
76
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
67
77
68
78
@available ( SwiftStdlib 5 . 9 , * )
69
79
extension SerialExecutor {
@@ -159,11 +169,15 @@ internal func _getJobTaskId(_ job: UnownedJob) -> UInt64
159
169
@_silgen_name ( " _swift_task_enqueueOnExecutor " )
160
170
internal func _enqueueOnExecutor< E > ( job unownedJob: UnownedJob, executor: E)
161
171
where E: SerialExecutor {
172
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
162
173
if #available( SwiftStdlib 5 . 9 , * ) {
163
174
executor. enqueue ( Job ( context: unownedJob. _context) )
164
175
} else {
165
176
executor. enqueue ( unownedJob)
166
177
}
178
+ #else // SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
179
+ executor. enqueue ( unownedJob)
180
+ #endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
167
181
}
168
182
169
183
#if !SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY && !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
0 commit comments