authorgravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 17:52:40+09:00
committergravatar for kt@connectfree.co.jpkristopher tate <kt@connectfree.co.jp> 2018-08-02 17:52:40+09:00
log96a94e7da933dafec25356c435f5725c3cb0ce04
tree5227e8bb2321f27bfd908cd8a601b3360aca19bb
parentac0a87d58d72a8c1fbb9b0af2d3818075729d85a

std/event: directly return @handle();

Tracking Issue #1296 ;

4 files changed, 6 insertions(+), 12 deletions(-)

std/event/future.zig+3-6
......@@ -101,8 +101,7 @@ test "std.event.Future" {
101101
102102async fn testFuture(loop: *Loop) void {
103103 suspend {
104 var h: promise = @handle();
105 resume h;
104 resume @handle();
106105 }
107106 var future = Future(i32).init(loop);
108107
......@@ -117,16 +116,14 @@ async fn testFuture(loop: *Loop) void {
117116
118117async fn waitOnFuture(future: *Future(i32)) i32 {
119118 suspend {
120 var h: promise = @handle();
121 resume h;
119 resume @handle();
122120 }
123121 return (await (async future.get() catch @panic("memory"))).*;
124122}
125123
126124async fn resolveFuture(future: *Future(i32)) void {
127125 suspend {
128 var h: promise = @handle();
129 resume h;
126 resume @handle();
130127 }
131128 future.data = 6;
132129 future.resolve();
std/event/group.zig+1-2
......@@ -57,8 +57,7 @@ pub fn Group(comptime ReturnType: type) type {
5757 suspend {
5858 var my_node: Stack.Node = undefined;
5959 node.* = &my_node;
60 var h: promise = @handle();
61 resume h;
60 resume @handle();
6261 }
6362
6463 // TODO this allocation elision should be guaranteed because we await it in
std/event/lock.zig+1-2
......@@ -142,8 +142,7 @@ test "std.event.Lock" {
142142async fn testLock(loop: *Loop, lock: *Lock) void {
143143 // TODO explicitly put next tick node memory in the coroutine frame #1194
144144 suspend {
145 var h: promise = @handle();
146 resume h;
145 resume @handle();
147146 }
148147 const handle1 = async lockRunner(lock) catch @panic("out of memory");
149148 var tick_node1 = Loop.NextTickNode{
std/event/tcp.zig+1-2
......@@ -142,8 +142,7 @@ test "listen on a port, send bytes, receive bytes" {
142142 std.debug.panic("unable to handle connection: {}\n", err);
143143 };
144144 suspend {
145 var h: promise = @handle();
146 cancel h;
145 cancel @handle();
147146 }
148147 }
149148 async fn errorableHandler(self: *Self, _addr: *const std.net.Address, _socket: *const std.os.File) !void {