mirror of
https://github.com/danog/parallel.git
synced 2024-12-12 00:59:46 +01:00
20 lines
429 B
PHP
20 lines
429 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Worker;
|
|
|
|
/**
|
|
* A runnable unit of execution.
|
|
*/
|
|
interface Task {
|
|
/**
|
|
* Runs the task inside the caller's context.
|
|
*
|
|
* Does not have to be a coroutine, can also be a regular function returning a value.
|
|
*
|
|
* @param \Amp\Parallel\Worker\Environment
|
|
*
|
|
* @return mixed|\Interop\Async\Promise|\Generator
|
|
*/
|
|
public function run(Environment $environment);
|
|
}
|