aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-30 13:07:04 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-30 13:07:04 -0400
commitcfe03c764de0d2edfbad74a71d7c18f0fd68b506 (patch)
tree0aa391152b43f52e3095a22fb09caaa2d39be3c9 /doc
parentc91c781952bd9750c029a48d0dd7a5a24ec089cf (diff)
downloadzig-cfe03c764de0d2edfbad74a71d7c18f0fd68b506.tar.gz
zig-cfe03c764de0d2edfbad74a71d7c18f0fd68b506.zip
fix docs for break from suspend
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in12
1 files changed, 6 insertions, 6 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index d91fb6e8fb..0499c632e2 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -4665,24 +4665,24 @@ async fn testSuspendBlock() void {
block, while the old thread continued executing the suspend block.
</p>
<p>
- However, if you use labeled <code>break</code> on the suspend block, the coroutine
+ However, the coroutine can be directly resumed from the suspend block, in which case it
never returns to its resumer and continues executing.
</p>
{#code_begin|test#}
const std = @import("std");
const assert = std.debug.assert;
-test "break from suspend" {
+test "resume from suspend" {
var buf: [500]u8 = undefined;
var a = &std.heap.FixedBufferAllocator.init(buf[0..]).allocator;
var my_result: i32 = 1;
- const p = try async<a> testBreakFromSuspend(&my_result);
+ const p = try async<a> testResumeFromSuspend(&my_result);
cancel p;
std.debug.assert(my_result == 2);
}
-async fn testBreakFromSuspend(my_result: *i32) void {
- s: suspend |p| {
- break :s;
+async fn testResumeFromSuspend(my_result: *i32) void {
+ suspend |p| {
+ resume p;
}
my_result.* += 1;
suspend;