authorgravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-07-29 17:12:52+09:00
committergravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 16:59:11+09:00
log244a7fdafb97b215e0e9e3e8aaa23777eccebd14
tree7631400c7b733ac4677d386198e0f59164105e13
parent29057e5511ed007ee8db8306e89b674384c35964

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

Tracking Issue #1296 ;

1 files changed, 9 insertions(+), 6 deletions(-)

std/event/future.zig+9-6
...@@ -100,8 +100,9 @@ test "std.event.Future" {...@@ -100,8 +100,9 @@ test "std.event.Future" {
100}100}
101101
102async fn testFuture(loop: *Loop) void {102async fn testFuture(loop: *Loop) void {
103 suspend |p| {103 suspend {
104 resume p;104 var h: promise = @handle();
105 resume h;
105 }106 }
106 var future = Future(i32).init(loop);107 var future = Future(i32).init(loop);
107108
...@@ -115,15 +116,17 @@ async fn testFuture(loop: *Loop) void {...@@ -115,15 +116,17 @@ async fn testFuture(loop: *Loop) void {
115}116}
116117
117async fn waitOnFuture(future: *Future(i32)) i32 {118async fn waitOnFuture(future: *Future(i32)) i32 {
118 suspend |p| {119 suspend {
119 resume p;120 var h: promise = @handle();
121 resume h;
120 }122 }
121 return (await (async future.get() catch @panic("memory"))).*;123 return (await (async future.get() catch @panic("memory"))).*;
122}124}
123125
124async fn resolveFuture(future: *Future(i32)) void {126async fn resolveFuture(future: *Future(i32)) void {
125 suspend |p| {127 suspend {
126 resume p;128 var h: promise = @handle();
129 resume h;
127 }130 }
128 future.data = 6;131 future.data = 6;
129 future.resolve();132 future.resolve();