2016-08-22 06:40:48 +02:00
|
|
|
<?php declare(strict_types = 1);
|
2016-08-18 18:04:48 +02:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel\Worker;
|
2015-08-14 19:25:07 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A runnable unit of execution.
|
|
|
|
*/
|
2016-08-18 18:04:48 +02:00
|
|
|
interface Task {
|
2015-08-14 19:25:07 +02:00
|
|
|
/**
|
|
|
|
* Runs the task inside the caller's context.
|
|
|
|
*
|
2015-09-01 23:20:57 +02:00
|
|
|
* Does not have to be a coroutine, can also be a regular function returning a value.
|
2015-08-27 16:10:08 +02:00
|
|
|
*
|
2016-08-23 23:47:40 +02:00
|
|
|
* @param \Amp\Parallel\Worker\Environment
|
2015-08-27 16:10:08 +02:00
|
|
|
*
|
2016-11-15 00:43:44 +01:00
|
|
|
* @return mixed|\Interop\Async\Promise|\Generator
|
2015-08-14 19:25:07 +02:00
|
|
|
*/
|
2016-01-25 06:04:29 +01:00
|
|
|
public function run(Environment $environment);
|
2015-08-14 19:25:07 +02:00
|
|
|
}
|