mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
std/event/lock.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;
This commit is contained in:
parent
b4ff464d39
commit
efec3a0e34
@ -90,10 +90,10 @@ pub const Lock = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn acquire(self: *Lock) Held {
|
pub async fn acquire(self: *Lock) Held {
|
||||||
suspend |handle| {
|
suspend {
|
||||||
// TODO explicitly put this memory in the coroutine frame #1194
|
// TODO explicitly put this memory in the coroutine frame #1194
|
||||||
var my_tick_node = Loop.NextTickNode{
|
var my_tick_node = Loop.NextTickNode{
|
||||||
.data = handle,
|
.data = @handle(),
|
||||||
.next = undefined,
|
.next = undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -141,8 +141,9 @@ test "std.event.Lock" {
|
|||||||
|
|
||||||
async fn testLock(loop: *Loop, lock: *Lock) void {
|
async fn testLock(loop: *Loop, lock: *Lock) void {
|
||||||
// TODO explicitly put next tick node memory in the coroutine frame #1194
|
// TODO explicitly put next tick node memory in the coroutine frame #1194
|
||||||
suspend |p| {
|
suspend {
|
||||||
resume p;
|
var h: promise = @handle();
|
||||||
|
resume h;
|
||||||
}
|
}
|
||||||
const handle1 = async lockRunner(lock) catch @panic("out of memory");
|
const handle1 = async lockRunner(lock) catch @panic("out of memory");
|
||||||
var tick_node1 = Loop.NextTickNode{
|
var tick_node1 = Loop.NextTickNode{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user