diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-04 15:19:03 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-04 15:19:03 -0400 |
| commit | b48948d6e805cdee7f33243098af9a862c152df1 (patch) | |
| tree | 8b1b4b37670f7444e8fe12748a8db99ac7498cce /std/event/loop.zig | |
| parent | f804310d9f953c9d78a4271ba8d75133341840e6 (diff) | |
| parent | 9bd8b01650f9cf21e601117951711b21aa5fd216 (diff) | |
| download | zig-b48948d6e805cdee7f33243098af9a862c152df1.tar.gz zig-b48948d6e805cdee7f33243098af9a862c152df1.zip | |
Merge branch 'master' into llvm7
Diffstat (limited to 'std/event/loop.zig')
| -rw-r--r-- | std/event/loop.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/std/event/loop.zig b/std/event/loop.zig index 4e219653be..8b1b2e53db 100644 --- a/std/event/loop.zig +++ b/std/event/loop.zig @@ -331,11 +331,11 @@ pub const Loop = struct { pub async fn waitFd(self: *Loop, fd: i32) !void { defer self.removeFd(fd); - suspend |p| { + suspend { // TODO explicitly put this memory in the coroutine frame #1194 var resume_node = ResumeNode{ .id = ResumeNode.Id.Basic, - .handle = p, + .handle = @handle(), }; try self.addFd(fd, &resume_node); } @@ -417,11 +417,11 @@ pub const Loop = struct { pub fn call(self: *Loop, comptime func: var, args: ...) !(promise->@typeOf(func).ReturnType) { const S = struct { async fn asyncFunc(loop: *Loop, handle: *promise->@typeOf(func).ReturnType, args2: ...) @typeOf(func).ReturnType { - suspend |p| { - handle.* = p; + suspend { + handle.* = @handle(); var my_tick_node = Loop.NextTickNode{ .next = undefined, - .data = p, + .data = @handle(), }; loop.onNextTick(&my_tick_node); } @@ -439,10 +439,10 @@ pub const Loop = struct { /// CPU bound tasks would be waiting in the event loop but never get started because no async I/O /// is performed. pub async fn yield(self: *Loop) void { - suspend |p| { + suspend { var my_tick_node = Loop.NextTickNode{ .next = undefined, - .data = p, + .data = @handle(), }; self.onNextTick(&my_tick_node); } |
