2016-12-30 03:59:59 +01:00
|
|
|
<?php
|
2016-08-30 21:05:14 +02:00
|
|
|
|
|
|
|
namespace Amp\File\Test;
|
|
|
|
|
2017-05-18 17:31:20 +02:00
|
|
|
use Amp\File;
|
2017-05-18 05:59:17 +02:00
|
|
|
use Amp\Loop;
|
2016-08-30 21:05:14 +02:00
|
|
|
use Amp\Parallel\Worker\DefaultPool;
|
2017-05-18 17:31:20 +02:00
|
|
|
use function Amp\call;
|
2016-08-30 21:05:14 +02:00
|
|
|
|
2018-10-27 17:57:31 +02:00
|
|
|
class ParallelHandleTest extends AsyncHandleTest
|
|
|
|
{
|
|
|
|
protected function execute(callable $cb)
|
|
|
|
{
|
2017-06-17 23:41:57 +02:00
|
|
|
Loop::run(function () use ($cb) {
|
2017-05-18 17:31:20 +02:00
|
|
|
$pool = new DefaultPool;
|
2017-05-18 05:59:17 +02:00
|
|
|
|
2017-05-18 17:31:20 +02:00
|
|
|
File\filesystem(new File\ParallelDriver($pool));
|
|
|
|
yield call($cb);
|
2017-05-18 05:59:17 +02:00
|
|
|
|
2017-05-18 17:31:20 +02:00
|
|
|
yield $pool->shutdown();
|
2016-08-30 21:05:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|