2015-08-14 12:25:07 -05:00
|
|
|
<?php
|
|
|
|
namespace Icicle\Concurrent\Worker;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A runnable unit of execution.
|
|
|
|
*/
|
2015-12-04 23:50:32 -06:00
|
|
|
interface Task
|
2015-08-14 12:25:07 -05:00
|
|
|
{
|
|
|
|
/**
|
2015-08-27 09:10:08 -05:00
|
|
|
* @coroutine
|
|
|
|
*
|
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
|
|
|
*
|
2015-09-09 23:29:41 -05:00
|
|
|
* @param \Icicle\Concurrent\Worker\Environment
|
|
|
|
*
|
2015-08-27 09:10:08 -05:00
|
|
|
* @return \Generator
|
|
|
|
*
|
|
|
|
* @resolve mixed
|
2015-08-14 12:25:07 -05:00
|
|
|
*/
|
2015-09-09 23:29:41 -05:00
|
|
|
public function run(Environment $environment);
|
2015-08-14 12:25:07 -05:00
|
|
|
}
|