Skip to content

Commit 4bb52cc

Browse files
committed
Workaround for rdar://74957357
1 parent 14ab1a2 commit 4bb52cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,20 +478,21 @@ public func _runAsyncHandler(operation: @escaping () async -> ()) {
478478
///
479479
/// This function does _not_ block the underlying thread.
480480
public static func sleep(_ duration: UInt64) async {
481-
482481
// Set up the job flags for a new task.
483482
var flags = JobFlags()
484483
flags.kind = .task
485484
flags.priority = .default
486485
flags.isFuture = true
487486

488487
// Create the asynchronous task future.
489-
let (task, _) = Builtin.createAsyncTaskFuture(flags.bits, nil, {})
488+
// FIXME: This should be an empty closure instead. Returning `0` here is
489+
// a workaround for rdar://74957357
490+
let (task, _) = Builtin.createAsyncTaskFuture(flags.bits, nil, { return 0 })
490491

491492
// Enqueue the resulting job.
492493
_enqueueJobGlobalWithDelay(duration, Builtin.convertTaskToJob(task))
493494

494-
let _ = await Handle<Void, Never>(task).get()
495+
let _ = await Handle<Int, Never>(task).get()
495496
}
496497
// ==== UnsafeCurrentTask ------------------------------------------------------
497498

0 commit comments

Comments
 (0)