# Parallel
Parallel 是一个并行任务调度工具,允许在程序中同时执行多个异步任务,并在所有任务完成后获取结果。Parallel是基于Barrier实现的。Worker::runAll();
```
## 接口说明
```php
interface ParallelInterface
{
/**
* 构造函数,$concurrent为并行任务数,-1表示不限制并行任务数
*/
public function __construct(int $concurrent = -1);
/**
* 添加一个并行任务string $key = null): void;
/**
* 等待所有任务完成并返回结果
*/
public function wait(): array;/**
* 获取任务中发生异常的结果
*/
public function getExceptions(): array;
}
```