-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
Internally, await
is a suspend
block that reaches into the coroutine's frame, atomically modifies the awaiter pointer, and then based on the previous value of the awaiter pointer, might decide not to suspend after all.
We could expose this ability to zig programmers, like this:
suspend |p| {
const prev_value = @atomicRmw(usize, &something, AtomicRmwOp.Xchg, something_else, AtomicOrder.SeqCst);
if (prev_value == 0) {
queue(p);
} else {
break;
}
}
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.