func _block_wait(reasons: [WaitReason]) -> ()The blocking wait fallback's body, shared with cooperative package schedulers that install their own root fallbacks: register every reason, block the worker, unregister, and return. Element access stays on the Optional-returning accessor: the trapping get would make 'panic reachable from this always-installed fallback and keep the panic host alive in programs that cannot panic.
View Source
pub func _block_wait(reasons: [WaitReason]) -> () {
let i = 0
loop i < reasons.count {
if let .some(reason) = reasons._index_iterable_get(i: i) {
match reason {
.recv(handle) -> {
let registered = _chan_ctl(handle: handle, op: 4)
()
},
.send(handle) -> {
let registered = _chan_ctl(handle: handle, op: 11)
()
},
.deadline(instant) -> {
let registered = _chan_ctl(handle: instant._nanoseconds(), op: 14)
()
}
}
}
i = i + 1
}
let parked = _chan_ctl(handle: 0, op: 6)
let j = 0
loop j < reasons.count {
if let .some(reason) = reasons._index_iterable_get(i: j) {
match reason {
.recv(handle) -> {
let released = _chan_ctl(handle: handle, op: 5)
()
},
.send(handle) -> {
let released = _chan_ctl(handle: handle, op: 12)
()
},
.deadline(instant) -> {
let released = _chan_ctl(handle: instant._nanoseconds(), op: 15)
()
}
}
}
j = j + 1
}
}