@@ -35,6 +35,7 @@ public struct UnownedJob: Sendable {
35
35
}
36
36
}
37
37
38
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
38
39
/// A mechanism to interface
39
40
/// between synchronous and asynchronous code,
40
41
/// without correctness checking.
@@ -213,6 +214,46 @@ extension UnsafeContinuation {
213
214
self . resume ( returning: ( ) )
214
215
}
215
216
}
217
+ #else
218
+ @available ( SwiftStdlib 5 . 1 , * )
219
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
220
+ public struct UnsafeContinuation < T, E: Error > : Sendable {
221
+ @available ( SwiftStdlib 5 . 1 , * )
222
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
223
+ public func resume( returning value: __owned T) where E == Never {
224
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
225
+ }
226
+ @available ( SwiftStdlib 5 . 1 , * )
227
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
228
+ public func resume( returning value: __owned T) {
229
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
230
+ }
231
+ @available ( SwiftStdlib 5 . 1 , * )
232
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
233
+ public func resume( throwing error: __owned E) {
234
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
235
+ }
236
+ }
237
+ @available ( SwiftStdlib 5 . 1 , * )
238
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
239
+ extension UnsafeContinuation {
240
+ @available ( SwiftStdlib 5 . 1 , * )
241
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
242
+ public func resume< Er: Error > ( with result: Result < T , Er > ) where E == Error {
243
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
244
+ }
245
+ @available ( SwiftStdlib 5 . 1 , * )
246
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
247
+ public func resume( with result: Result < T , E > ) {
248
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
249
+ }
250
+ @available ( SwiftStdlib 5 . 1 , * )
251
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
252
+ public func resume( ) where T == Void {
253
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
254
+ }
255
+ }
256
+ #endif
216
257
217
258
#if _runtime(_ObjC)
218
259
@@ -246,6 +287,8 @@ internal func _resumeUnsafeThrowingContinuationWithError<T>(
246
287
247
288
#endif
248
289
290
+
291
+ #if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
249
292
/// Suspends the current task,
250
293
/// then calls the given closure with an unsafe continuation for the current task.
251
294
///
@@ -291,3 +334,20 @@ public func withUnsafeThrowingContinuation<T>(
291
334
public func _abiEnableAwaitContinuation( ) {
292
335
fatalError ( " never use this function " )
293
336
}
337
+ #else
338
+ @available ( SwiftStdlib 5 . 1 , * )
339
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
340
+ public func withUnsafeContinuation< T> (
341
+ _ fn: ( UnsafeContinuation < T , Never > ) -> Void
342
+ ) async -> T {
343
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
344
+ }
345
+
346
+ @available ( SwiftStdlib 5 . 1 , * )
347
+ @available ( * , unavailable, message: " Unavailable in task-to-thread concurrency model " )
348
+ public func withUnsafeThrowingContinuation< T> (
349
+ _ fn: ( UnsafeContinuation < T , Error > ) -> Void
350
+ ) async throws -> T {
351
+ fatalError ( " Unavailable in task-to-thread concurrency model " )
352
+ }
353
+ #endif
0 commit comments