Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit ea206b9

Browse files
committed
* fix suspend => suspend()
1 parent 5cd9ef4 commit ea206b9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

base.rfc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Example:
6868
<code php>
6969
spawn(function() {
7070
echo "Start";
71-
suspend; // Suspend the coroutine
71+
suspend(); // Suspend the coroutine
7272
echo "Resumed";
7373
});
7474
</code>
@@ -112,7 +112,7 @@ $coroutine = spawn(function() {
112112
}
113113
});
114114

115-
suspend;
115+
suspend();
116116

117117
$coroutine->cancel();
118118
</code>
@@ -788,7 +788,7 @@ function example(string $name): void {
788788
echo "Hello, $name!";
789789

790790
try {
791-
suspend;
791+
suspend();
792792
} catch (Exception $e) {
793793
echo "Caught exception: ", $e->getMessage();
794794
}
@@ -799,7 +799,7 @@ function example(string $name): void {
799799
$coroutine = spawn('example', 'World');
800800

801801
// pass control to the coroutine
802-
suspend;
802+
suspend();
803803

804804
$coroutine->cancel();
805805
</code>
@@ -2126,14 +2126,14 @@ use Async\CoroutineGroup;
21262126
$coroutineGroup = new Async\CoroutineGroup(captureResults: false);
21272127
$coroutineGroup->spawn(function() {
21282128
try {
2129-
suspend;
2129+
suspend();
21302130
} catch (Throwable $throwable) {
21312131
echo "Task was cancelled: ", $throwable->getMessage(), "\n";
21322132
}
21332133
});
21342134

21352135
// pass control to the task
2136-
suspend;
2136+
suspend();
21372137

21382138
$coroutineGroup->cancel(new \Async\CancellationException('Custom cancellation message'));
21392139
</code>
@@ -2306,7 +2306,7 @@ function copyFile(string $sourceFile, string $targetFile): void
23062306
$buffer = $chunk !== false && $chunk !== '' ? $chunk : null;
23072307
}
23082308

2309-
suspend;
2309+
suspend();
23102310
}
23112311

23122312
$buffer = '';
@@ -2324,7 +2324,7 @@ function copyFile(string $sourceFile, string $targetFile): void
23242324
$buffer = null;
23252325
}
23262326

2327-
suspend;
2327+
suspend();
23282328
}
23292329

23302330
echo "Copy complete.\n";

0 commit comments

Comments
 (0)