std/event/future.zig: remove promise_symbol from suspend and use @handle();

Tracking Issue #1296 ;
master
kristopher tate 2018-07-29 17:12:52 +09:00
parent 29057e5511
commit 244a7fdafb
1 changed files with 9 additions and 6 deletions

View File

@ -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();