1
0
mirror of https://github.com/danog/parallel.git synced 2025-01-23 06:21:12 +01:00
parallel/lib/Worker/Task.php

20 lines
456 B
PHP
Raw Normal View History

2016-08-21 23:40:48 -05:00
<?php declare(strict_types = 1);
2016-08-18 11:04:48 -05:00
2016-08-23 16:47:40 -05:00
namespace Amp\Parallel\Worker;
/**
* A runnable unit of execution.
*/
2016-08-18 11:04:48 -05:00
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.
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
*
2016-11-14 17:43:44 -06:00
* @return mixed|\Interop\Async\Promise|\Generator
*/
2016-01-24 23:04:29 -06:00
public function run(Environment $environment);
}