Skip to content

Commit

Permalink
update line #s
Browse files Browse the repository at this point in the history
Signed-off-by: Demin Yin <deminy@deminy.net>
  • Loading branch information
deminy committed Dec 19, 2023
1 parent ae7fb40 commit da0ff5a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/csp/deadlocks/server-shutdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* docker run --rm -v $(pwd):/var/www -ti phpswoole/swoole php ./examples/csp/deadlocks/server-shutdown.php
* When the script is executed, it will print out the following error message:
* [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock!
* To fix the deadlock, uncomment line 41 and line 32, then rerun the script.
* To fix the deadlock, uncomment line 40 and line 31, then rerun the script.
*/

use Swoole\Coroutine;
Expand All @@ -27,7 +27,7 @@
$cid = Coroutine::create(function () {
while (true) { // @phpstan-ignore while.alwaysTrue
if (Coroutine::isCanceled()) {
// The deadlock can be resolved by uncommenting line 41 and line 32.
// The deadlock can be resolved by uncommenting line 40 and line 31.
// break; #2: Quit the infinite loop after the coroutine is canceled.
}
Coroutine::sleep(0.01);
Expand All @@ -36,7 +36,7 @@

// Shutdown the server after 2 seconds.
Timer::after(2_000, function () use ($server, $cid) { // @phpstan-ignore closure.unusedUse
// The deadlock can be resolved by uncommenting line 41 and line 32.
// The deadlock can be resolved by uncommenting line 40 and line 31.
// Coroutine::cancel($cid); #1: Cancel the coroutine before shutting down the server.

echo 'The server is shutting down.', PHP_EOL;
Expand Down

0 comments on commit da0ff5a

Please sign in to comment.