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 {
|
||||
suspend |p| {
|
||||
resume p;
|
||||
suspend {
|
||||
var h: promise = @handle();
|
||||
resume h;
|
||||
}
|
||||
var future = Future(i32).init(loop);
|
||||
|
||||
|
@ -115,15 +116,17 @@ async fn testFuture(loop: *Loop) void {
|
|||
}
|
||||
|
||||
async fn waitOnFuture(future: *Future(i32)) i32 {
|
||||
suspend |p| {
|
||||
resume p;
|
||||
suspend {
|
||||
var h: promise = @handle();
|
||||
resume h;
|
||||
}
|
||||
return (await (async future.get() catch @panic("memory"))).*;
|
||||
}
|
||||
|
||||
async fn resolveFuture(future: *Future(i32)) void {
|
||||
suspend |p| {
|
||||
resume p;
|
||||
suspend {
|
||||
var h: promise = @handle();
|
||||
resume h;
|
||||
}
|
||||
future.data = 6;
|
||||
future.resolve();
|
||||
|
|
Loading…
Reference in New Issue