2016-12-29 19:16:04 -06:00
|
|
|
<?php
|
2016-08-18 11:04:48 -05:00
|
|
|
|
2016-08-23 16:47:40 -05:00
|
|
|
namespace Amp\Parallel\Worker;
|
2015-08-14 12:25:07 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A runnable unit of execution.
|
|
|
|
*/
|
2018-10-07 09:50:45 -05:00
|
|
|
interface Task
|
|
|
|
{
|
2015-08-14 12:25:07 -05:00
|
|
|
/**
|
|
|
|
* Runs the task inside the caller's context.
|
|
|
|
*
|
2015-09-01 16:20:57 -05:00
|
|
|
* Does not have to be a coroutine, can also be a regular function returning a value.
|
2015-08-27 09:10:08 -05:00
|
|
|
*
|
2016-08-23 16:47:40 -05:00
|
|
|
* @param \Amp\Parallel\Worker\Environment
|
2015-08-27 09:10:08 -05:00
|
|
|
*
|
2017-03-16 17:03:59 -05:00
|
|
|
* @return mixed|\Amp\Promise|\Generator
|
2015-08-14 12:25:07 -05:00
|
|
|
*/
|
2016-01-24 23:04:29 -06:00
|
|
|
public function run(Environment $environment);
|
2015-08-14 12:25:07 -05:00
|
|
|
}
|