| ... | @@ -331,11 +331,11 @@ pub const Loop = struct { | ... | @@ -331,11 +331,11 @@ pub const Loop = struct { |
| 331 | | 331 | |
| 332 | pub async fn waitFd(self: *Loop, fd: i32) !void { | 332 | pub async fn waitFd(self: *Loop, fd: i32) !void { |
| 333 | defer self.removeFd(fd); | 333 | defer self.removeFd(fd); |
| 334 | suspend |p| { | 334 | suspend { |
| 335 | // TODO explicitly put this memory in the coroutine frame #1194 | 335 | // TODO explicitly put this memory in the coroutine frame #1194 |
| 336 | var resume_node = ResumeNode{ | 336 | var resume_node = ResumeNode{ |
| 337 | .id = ResumeNode.Id.Basic, | 337 | .id = ResumeNode.Id.Basic, |
| 338 | .handle = p, | 338 | .handle = @handle(), |
| 339 | }; | 339 | }; |
| 340 | try self.addFd(fd, &resume_node); | 340 | try self.addFd(fd, &resume_node); |
| 341 | } | 341 | } |
| ... | @@ -417,11 +417,11 @@ pub const Loop = struct { | ... | @@ -417,11 +417,11 @@ pub const Loop = struct { |
| 417 | pub fn call(self: *Loop, comptime func: var, args: ...) !(promise->@typeOf(func).ReturnType) { | 417 | pub fn call(self: *Loop, comptime func: var, args: ...) !(promise->@typeOf(func).ReturnType) { |
| 418 | const S = struct { | 418 | const S = struct { |
| 419 | async fn asyncFunc(loop: *Loop, handle: *promise->@typeOf(func).ReturnType, args2: ...) @typeOf(func).ReturnType { | 419 | async fn asyncFunc(loop: *Loop, handle: *promise->@typeOf(func).ReturnType, args2: ...) @typeOf(func).ReturnType { |
| 420 | suspend |p| { | 420 | suspend { |
| 421 | handle.* = p; | 421 | handle.* = @handle(); |
| 422 | var my_tick_node = Loop.NextTickNode{ | 422 | var my_tick_node = Loop.NextTickNode{ |
| 423 | .next = undefined, | 423 | .next = undefined, |
| 424 | .data = p, | 424 | .data = @handle(), |
| 425 | }; | 425 | }; |
| 426 | loop.onNextTick(&my_tick_node); | 426 | loop.onNextTick(&my_tick_node); |
| 427 | } | 427 | } |
| ... | @@ -439,10 +439,10 @@ pub const Loop = struct { | ... | @@ -439,10 +439,10 @@ pub const Loop = struct { |
| 439 | /// CPU bound tasks would be waiting in the event loop but never get started because no async I/O | 439 | /// CPU bound tasks would be waiting in the event loop but never get started because no async I/O |
| 440 | /// is performed. | 440 | /// is performed. |
| 441 | pub async fn yield(self: *Loop) void { | 441 | pub async fn yield(self: *Loop) void { |
| 442 | suspend |p| { | 442 | suspend { |
| 443 | var my_tick_node = Loop.NextTickNode{ | 443 | var my_tick_node = Loop.NextTickNode{ |
| 444 | .next = undefined, | 444 | .next = undefined, |
| 445 | .data = p, | 445 | .data = @handle(), |
| 446 | }; | 446 | }; |
| 447 | self.onNextTick(&my_tick_node); | 447 | self.onNextTick(&my_tick_node); |
| 448 | } | 448 | } |