@@ -298,7 +298,7 @@ However, it cannot be stopped externally.
298298> It is permissible to stop a coroutine’s execution externally for two reasons:
299299> * To implement multitasking.
300300> * To enforce an active execution time limit.
301- > Please see [ Maximum activity interval] ( #maximum-activity-interval ) for more information.
301+ > Please see [ Maximum activity interval] ( #maximum-activity-interval ) for more information.
302302
303303A suspended coroutine can be resumed at any time.
304304The ` Scheduler ` component is responsible for the coroutine resumption algorithm.
@@ -511,14 +511,14 @@ function defineTargetIpV4(string $host): string {
511511 return gethostbyname($host);
512512}
513513
514- spawn with $scope test ($host);
514+ spawn with $scope defineTargetIpV4 ($host);
515515```
516516
517517The `scope` expression can be:
518518- A variable:
519519
520520```php
521- spawn with $scope function :void {
521+ spawn with $scope use() :void {
522522 echo gethostbyname( ' php.net' ).PHP_EOL;
523523};
524524```
@@ -728,8 +728,8 @@ Inside each coroutine,
728728there is an illusion that all actions are executed sequentially,
729729while in reality, operations occur asynchronously.
730730
731- This ** RFC** proposes support for core PHP functions that require non-blocking input/output,
732- as well as support for CURL, Socket, and other extensions based on the ** PHP Stream API** .
731+ This ** RFC** proposes support for core ` PHP ` functions that require non-blocking input/output,
732+ as well as support for ` cURL ` , ` Socket ` , and other extensions based on the ** PHP Stream API** .
733733Please see Unaffected PHP Functionality.
734734
735735### Awaitable interface
@@ -1370,6 +1370,17 @@ Then, it waits for any remaining tasks. If there are any, a `CancellationExcepti
13701370and the code logs information about which coroutines were not properly completed.
13711371After that, it waits for their completion again.
13721372
1373+ #### Scope Ownership
1374+
1375+ The following expressions do not affect the reference count of the ` $scope ` object:
1376+ * ` spawn with $scope `
1377+ * ` Scope::inherit($scope) ` does ** not** increase the reference count of either the parent or the child ` $scope ` .
1378+
1379+ The following statements are true:
1380+ 1 . The lifetime of a child ` Scope ` cannot exceed that of its parent.
1381+ If the parent is destroyed, the child ` Scope ` will be closed.
1382+ 2 . If the child ` Scope ` is released, the parent will automatically lose its connection to it.
1383+
13731384#### directTasks and allTasks
13741385
13751386The ` Scope::directTasks ` and ` Scope::allTasks ` methods return a trigger object,
0 commit comments