std/event/future.zig: remove promise_symbol from suspend and use @handle();
Tracking Issue #1296 ;master
parent
29057e5511
commit
244a7fdafb
|
@ -100,8 +100,9 @@ test "std.event.Future" {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn testFuture(loop: *Loop) void {
|
async fn testFuture(loop: *Loop) void {
|
||||||
suspend |p| {
|
suspend {
|
||||||
resume p;
|
var h: promise = @handle();
|
||||||
|
resume h;
|
||||||
}
|
}
|
||||||
var future = Future(i32).init(loop);
|
var future = Future(i32).init(loop);
|
||||||
|
|
||||||
|
@ -115,15 +116,17 @@ async fn testFuture(loop: *Loop) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn waitOnFuture(future: *Future(i32)) i32 {
|
async fn waitOnFuture(future: *Future(i32)) i32 {
|
||||||
suspend |p| {
|
suspend {
|
||||||
resume p;
|
var h: promise = @handle();
|
||||||
|
resume h;
|
||||||
}
|
}
|
||||||
return (await (async future.get() catch @panic("memory"))).*;
|
return (await (async future.get() catch @panic("memory"))).*;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn resolveFuture(future: *Future(i32)) void {
|
async fn resolveFuture(future: *Future(i32)) void {
|
||||||
suspend |p| {
|
suspend {
|
||||||
resume p;
|
var h: promise = @handle();
|
||||||
|
resume h;
|
||||||
}
|
}
|
||||||
future.data = 6;
|
future.data = 6;
|
||||||
future.resolve();
|
future.resolve();
|
||||||
|
|
Loading…
Reference in New Issue