-
Notifications
You must be signed in to change notification settings - Fork 170
Closed
Labels
ResolvedQuestion answered or otherwise resolvedQuestion answered or otherwise resolved
Description
I'm using Swift dev snapshot 2022-03-02 with Xcode 13.3.
By making a small tweak to one of the Task.select
tests I am able to produce a deadlock:
let firstValue = await Task.select(Task {
+ try! await Task.sleep(until: .now + .seconds(1), clock: .continuous)
return 1
}, Task {
try! await Task.sleep(until: .now + .seconds(2), clock: .continuous)
return 2
}).value
It's worth noting that it does not deadlock if you use Task.sleep
without a clock:
let firstValue = await Task.select(Task {
try! await Task.sleep(nanoseconds: NSEC_PER_SEC)
return 1
}, Task {
try! await Task.sleep(nanoseconds: 2*NSEC_PER_SEC)
return 2
}).value
Is there something about clocks and sleeping that is causing this? I see the same behavior with suspending clocks too.
gohanlon
Metadata
Metadata
Assignees
Labels
ResolvedQuestion answered or otherwise resolvedQuestion answered or otherwise resolved