mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-21 21:53:11 -05:00
change suspend;
to suspend {}
This commit is contained in:
parent
7ef800c1bf
commit
433202d429
4 changed files with 6 additions and 6 deletions
|
@ -21,7 +21,7 @@
|
|||
// functions.
|
||||
//
|
||||
// fn fooThatSuspends() void {
|
||||
// suspend; // return control, but leave the frame alone
|
||||
// suspend {} // return control, but leave the frame alone
|
||||
// }
|
||||
//
|
||||
// 4. To call any function in async context and get a reference
|
||||
|
@ -51,6 +51,6 @@ pub fn main() void {
|
|||
|
||||
fn foo() void {
|
||||
print("foo() A\n", .{});
|
||||
suspend;
|
||||
suspend {}
|
||||
print("foo() B\n", .{});
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// async function invocation's frame and returns control to it.
|
||||
//
|
||||
// fn fooThatSuspends() void {
|
||||
// suspend;
|
||||
// suspend {}
|
||||
// }
|
||||
//
|
||||
// var foo_frame = async fooThatSuspends();
|
||||
|
@ -23,7 +23,7 @@ pub fn main() void {
|
|||
|
||||
fn foo() void {
|
||||
print("Hello ", .{});
|
||||
suspend;
|
||||
suspend {}
|
||||
print("async!\n", .{});
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,6 @@ fn foo(countdown: u32) void {
|
|||
while (current > 0) {
|
||||
print("{} ", .{current});
|
||||
current -= 1;
|
||||
suspend;
|
||||
suspend {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
< ???
|
||||
---
|
||||
> global_counter += 1;
|
||||
> suspend;
|
||||
> suspend {}
|
||||
|
|
Loading…
Reference in a new issue