This repository was archived by the owner on Jun 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +7
-7
lines changed
Expand file tree Collapse file tree 6 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -944,7 +944,7 @@ Caught exception: Error
944944#### Task Race
945945
946946Sometimes it's necessary to get the result of the fastest task from a set.
947- The ** ` Scope::anyDirectTasks ` ** method returns a trigger
947+ The ** ` Scope::firstDirectTask ` ** method returns a trigger
948948that fires as soon as at least one of the direct tasks in the ** Scope** is completed.
949949
950950** Example:**
@@ -960,7 +960,7 @@ function fetchDataFromApi(string ...$apiHosts): string
960960
961961 // Get the result of the fastest task
962962 // and cancel all other tasks
963- return await $scope->anyDirectTasks ();
963+ return await $scope->firstDirectTask ();
964964 };
965965}
966966
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ spawn use($some): void {
2222**[#87CEEB ] You want to wait with cancellation ?
2323***[#lightgreen ] Use await until : await $coroutine until $cancellation
2424**[#87CEEB ] Do you want to wait for at least one task (race )?
25- ***[#lightgreen ] Use await + Scope ::anyDirectTasks ()
25+ ***[#lightgreen ] Use await + Scope ::firstDirectTask ()
2626*[#lightblue ] Do you need to cancel tasks ?
2727**[#87CEEB ] Do you want to cancel a single coroutine ?
2828***[#lightgreen ] Use Coroutine ::cancel ()
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ async inherit $scope {
2727**[#FFD700 ] Waiting for direct child tasks
2828***[#lightgreen ] Scope ::directTasks ()
2929**[#FFD700 ] Waiting for first direct child tasks (race )
30- ***[#lightgreen ] Scope ::anyDirectTasks ()
30+ ***[#lightgreen ] Scope ::firstDirectTask ()
3131**[#FFD700 ] Waiting with cancellation
3232***[#lightgreen ]: await + until
3333
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public function cancel(?CancellationException $cancellationException = null): vo
2626
2727 public function directTasks (): Awaitable {}
2828
29- public function anyDirectTasks (): Awaitable {}
29+ public function firstDirectTask (): Awaitable {}
3030
3131 public function allTasks (): Awaitable {}
3232
You can’t perform that action at this time.
0 commit comments