|
35 | 35 | * SHOULD NOT be given unless you're sure you want to explicitly use a given event |
36 | 36 | * loop instance. |
37 | 37 | * |
| 38 | + * Note that this function will assume control over the event loop. Internally, it |
| 39 | + * will actually `run()` the loop until the timer fires and then calls `stop()` to |
| 40 | + * terminate execution of the loop. This means this function is more suited for |
| 41 | + * short-lived program executions when using async APIs is not feasible. For |
| 42 | + * long-running applications, using event-driven APIs by leveraging timers |
| 43 | + * is usually preferable. |
| 44 | + * |
38 | 45 | * @param float $time |
39 | 46 | * @param ?LoopInterface $loop |
40 | 47 | * @return void |
@@ -92,6 +99,13 @@ function sleep($time, LoopInterface $loop = null) |
92 | 99 | * This implies that if you pass a really small (or negative) value, it will still |
93 | 100 | * start a timer and will thus trigger at the earliest possible time in the future. |
94 | 101 | * |
| 102 | + * Note that this function will assume control over the event loop. Internally, it |
| 103 | + * will actually `run()` the loop until the promise settles and then calls `stop()` to |
| 104 | + * terminate execution of the loop. This means this function is more suited for |
| 105 | + * short-lived promise executions when using promise-based APIs is not feasible. |
| 106 | + * For long-running applications, using promise-based APIs by leveraging chained |
| 107 | + * `then()` calls is usually preferable. |
| 108 | + * |
95 | 109 | * @param PromiseInterface $promise |
96 | 110 | * @param ?LoopInterface $loop |
97 | 111 | * @param ?float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever |
@@ -196,6 +210,13 @@ function ($error) use (&$exception, &$rejected, &$wait, $loop) { |
196 | 210 | * value, it will still start a timer and will thus trigger at the earliest |
197 | 211 | * possible time in the future. |
198 | 212 | * |
| 213 | + * Note that this function will assume control over the event loop. Internally, it |
| 214 | + * will actually `run()` the loop until the promise settles and then calls `stop()` to |
| 215 | + * terminate execution of the loop. This means this function is more suited for |
| 216 | + * short-lived promise executions when using promise-based APIs is not feasible. |
| 217 | + * For long-running applications, using promise-based APIs by leveraging chained |
| 218 | + * `then()` calls is usually preferable. |
| 219 | + * |
199 | 220 | * @param PromiseInterface[] $promises |
200 | 221 | * @param ?LoopInterface $loop |
201 | 222 | * @param ?float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever |
@@ -287,6 +308,13 @@ function awaitAny(array $promises, LoopInterface $loop = null, $timeout = null) |
287 | 308 | * value, it will still start a timer and will thus trigger at the earliest |
288 | 309 | * possible time in the future. |
289 | 310 | * |
| 311 | + * Note that this function will assume control over the event loop. Internally, it |
| 312 | + * will actually `run()` the loop until the promise settles and then calls `stop()` to |
| 313 | + * terminate execution of the loop. This means this function is more suited for |
| 314 | + * short-lived promise executions when using promise-based APIs is not feasible. |
| 315 | + * For long-running applications, using promise-based APIs by leveraging chained |
| 316 | + * `then()` calls is usually preferable. |
| 317 | + * |
290 | 318 | * @param PromiseInterface[] $promises |
291 | 319 | * @param ?LoopInterface $loop |
292 | 320 | * @param ?float $timeout [deprecated] (optional) maximum timeout in seconds or null=wait forever |
|
0 commit comments