Skip to content

Commit 8b2bc9d

Browse files
authored
Update deprecated method (#3)
1 parent 75b4f23 commit 8b2bc9d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fibers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Suspensions allow awaiting an event by suspending the current execution context
1515
They will suspend the current fiber and return to the event loop, or start running the event loop if called from outside a fiber, i.e. from `{main}`.
1616

1717
Fibers should be suspended and resumed using the `Revolt\EventLoop\Suspension` API.
18-
`Suspension` objects can be created using `Revolt\EventLoop::createSuspension()`.
18+
`Suspension` objects can be created using `Revolt\EventLoop::getSuspension()`.
1919
After obtaining a `Suspension` object, an event callback can be registered to schedule the resumption of the current fiber.
2020
`$suspension->suspend()` will suspend the current execution context until it is resumed via `$suspension->resume()` or `$suspension->throw()`.
2121

@@ -37,7 +37,7 @@ if (\stream_set_blocking(STDIN, false) !== true) {
3737

3838
print "Write something and hit enter" . PHP_EOL;
3939

40-
$suspension = EventLoop::createSuspension();
40+
$suspension = EventLoop::getSuspension();
4141

4242
$readableId = EventLoop::onReadable(STDIN, function ($id, $stream) use ($suspension): void {
4343
EventLoop::cancel($id);

fundamentals.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ require __DIR__ . '/vendor/autoload.php';
6666

6767
use Revolt\EventLoop;
6868

69-
$suspension = EventLoop::createSuspension();
69+
$suspension = EventLoop::getSuspension();
7070

7171
$repeatId = EventLoop::repeat(1, function (): void {
7272
print '++ Executing callback created by EventLoop::repeat()' . PHP_EOL;
@@ -120,7 +120,7 @@ if (\stream_set_blocking(STDIN, false) !== true) {
120120

121121
print "Write something and hit enter" . PHP_EOL;
122122

123-
$suspension = EventLoop::createSuspension();
123+
$suspension = EventLoop::getSuspension();
124124

125125
$readableId = EventLoop::onReadable(STDIN, function ($id, $stream) use ($suspension): void {
126126
EventLoop::cancel($id);

0 commit comments

Comments
 (0)