Initial commit
This commit is contained in:
28
README.md
Normal file
28
README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# ReactPHP Utilities
|
||||
|
||||
## Installing
|
||||
|
||||
```bash
|
||||
$ composer set repositories.noccylabs \
|
||||
'{"type":"composer","url":"https://dev.noccylabs.info/api/packages/noccylabs/composer"}'
|
||||
$ composer require noccylabs/react-utilities
|
||||
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
### NoccyLabs\React\Utilities\defer(callable $cb)
|
||||
|
||||
This function is an alias for `Loop::futureTick`.
|
||||
|
||||
### NoccyLabs\React\Utilities\enqueue(callable $cb)
|
||||
|
||||
This function is a concurrency-friendly alternative to defer. If there is already a
|
||||
callback in the futureTick queue, this callback will be pushed to the end of an
|
||||
internal queue. Whenever an enqueued() callback is evaluated, if there is another
|
||||
callback in the queue, the next callback will be moved to the futureTick queue.
|
||||
|
||||
If you add 10 callbacks with `defer()` (or `Loop::futureTick()`) they will be
|
||||
enqueued and evaluated one after another, effectively immediately. This will block
|
||||
any yielding, and any other code-path that makes use of `defer()` will have to wait
|
||||
until the previous 10 callbacks have been evaluated.
|
Reference in New Issue
Block a user