mirror of
https://github.com/danog/file.git
synced 2024-11-26 11:54:54 +01:00
Update to amphp/parallel v1.0
This commit is contained in:
parent
cc1d11993e
commit
836e0ebb03
@ -34,7 +34,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"amphp/amp": "^2",
|
"amphp/amp": "^2",
|
||||||
"amphp/byte-stream": "^1",
|
"amphp/byte-stream": "^1",
|
||||||
"amphp/parallel": "^0.2"
|
"amphp/parallel": "^1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"amphp/phpunit-util": "^1",
|
"amphp/phpunit-util": "^1",
|
||||||
|
@ -29,7 +29,7 @@ class ParallelDriver implements Driver {
|
|||||||
*/
|
*/
|
||||||
public function open(string $path, string $mode): Promise {
|
public function open(string $path, string $mode): Promise {
|
||||||
return call(function () use ($path, $mode) {
|
return call(function () use ($path, $mode) {
|
||||||
$worker = $this->pool->get();
|
$worker = $this->pool->getWorker();
|
||||||
try {
|
try {
|
||||||
list($id, $size, $mode) = yield $worker->enqueue(new Internal\FileTask("fopen", [$path, $mode]));
|
list($id, $size, $mode) = yield $worker->enqueue(new Internal\FileTask("fopen", [$path, $mode]));
|
||||||
} catch (TaskException $exception) {
|
} catch (TaskException $exception) {
|
||||||
|
Loading…
Reference in New Issue
Block a user