Skip to content

Commit 289b0fe

Browse files
committed
Merge pull request #74 from async-interop/calltime_guarantees
Specify exact guarantees when a callback has to be called
2 parents c05ba0d + cf01250 commit 289b0fe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Loop/Driver.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function stop();
2828
/**
2929
* Defer the execution of a callback.
3030
*
31-
* The deferred callable MUST be executed in the next tick of the event loop.
31+
* The deferred callable MUST be executed in the next tick of the event loop and before any other type of watcher. Order of definition MUST be preserved when executing the callbacks.
3232
*
3333
* @param callable(string $watcherId, mixed $data) $callback The callback to defer. The $watcherId will be invalidated before the callback call.
3434
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
@@ -40,7 +40,7 @@ public function defer(callable $callback, $data = null);
4040
/**
4141
* Delay the execution of a callback.
4242
*
43-
* The delay is a minimum and approximate, accuracy is not guaranteed.
43+
* The delay is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which timers expire first and secondarily the order of definition.
4444
*
4545
* @param int $delay The amount of time, in milliseconds, to delay the execution for.
4646
* @param callable(string $watcherId, mixed $data) $callback The callback to delay. The $watcherId will be invalidated before the callback call.
@@ -53,7 +53,7 @@ public function delay($delay, callable $callback, $data = null);
5353
/**
5454
* Repeatedly execute a callback.
5555
*
56-
* The interval between executions is a minimum and approximate, accuracy is not guaranteed.
56+
* The interval between executions is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which timers expire first and secondarily the order of definition.
5757
* The first execution is scheduled after the first interval period.
5858
*
5959
* @param int $interval The time interval, in milliseconds, to wait between executions.
@@ -67,6 +67,8 @@ public function repeat($interval, callable $callback, $data = null);
6767
/**
6868
* Execute a callback when a stream resource becomes readable.
6969
*
70+
* In case of multiple watchers on a same stream, order of definition MUST be preserved when executing the callbacks.
71+
*
7072
* @param resource $stream The stream to monitor.
7173
* @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute.
7274
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
@@ -78,6 +80,8 @@ public function onReadable($stream, callable $callback, $data = null);
7880
/**
7981
* Execute a callback when a stream resource becomes writable.
8082
*
83+
* In case of multiple watchers on a same stream, order of definition MUST be preserved when executing the callbacks.
84+
*
8185
* @param resource $stream The stream to monitor.
8286
* @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute.
8387
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.
@@ -89,6 +93,8 @@ public function onWritable($stream, callable $callback, $data = null);
8993
/**
9094
* Execute a callback when a signal is received.
9195
*
96+
* In case of multiple watchers on a same signal, order of definition MUST be preserved when executing the callbacks.
97+
*
9298
* @param int $signo The signal number to monitor.
9399
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
94100
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.

0 commit comments

Comments
 (0)