1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/lib/Worker/Task.php

20 lines
435 B
PHP
Raw Normal View History

<?php
2016-08-18 18:04:48 +02:00
namespace Amp\Concurrent\Worker;
/**
* A runnable unit of execution.
*/
2016-08-18 18:04:48 +02: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 16:10:08 +02:00
*
2016-08-18 18:04:48 +02:00
* @param \Amp\Concurrent\Worker\Environment
2015-08-27 16:10:08 +02:00
*
2016-08-18 18:04:48 +02:00
* @return mixed|\Interop\Async\Awaitable|\Generator
*/
2016-01-25 06:04:29 +01:00
public function run(Environment $environment);
}