2016-12-29 19:16:04 -06:00
|
|
|
<?php
|
2015-08-27 09:10:08 -05:00
|
|
|
|
2017-12-07 21:26:55 -06:00
|
|
|
namespace Amp\Parallel\Context;
|
2016-08-18 11:04:48 -05:00
|
|
|
|
2017-12-07 21:26:55 -06:00
|
|
|
use Amp\Parallel\Sync\Channel;
|
2017-03-16 17:03:59 -05:00
|
|
|
use Amp\Promise;
|
2016-08-18 11:04:48 -05:00
|
|
|
|
2018-10-07 09:50:45 -05:00
|
|
|
interface Context extends Channel
|
|
|
|
{
|
2015-08-27 09:10:08 -05:00
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-01-23 00:00:56 -06:00
|
|
|
public function isRunning(): bool;
|
2015-08-27 09:10:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the execution context.
|
2018-10-11 11:14:14 -05:00
|
|
|
*
|
|
|
|
* @return Promise<null> Resolved once the context has started.
|
2015-08-27 09:10:08 -05:00
|
|
|
*/
|
2018-10-06 10:05:49 -05:00
|
|
|
public function start(): Promise;
|
2015-08-27 09:10:08 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Immediately kills the context.
|
|
|
|
*/
|
|
|
|
public function kill();
|
|
|
|
|
|
|
|
/**
|
2017-03-16 17:03:59 -05:00
|
|
|
* @return \Amp\Promise<mixed> Resolves with the returned from the context.
|
2017-03-09 16:15:30 -06:00
|
|
|
*
|
2017-12-07 21:26:55 -06:00
|
|
|
* @throws \Amp\Parallel\Context\ContextException If the context dies unexpectedly.
|
|
|
|
* @throws \Amp\Parallel\Sync\PanicError If the context throws an uncaught exception.
|
2015-08-27 09:10:08 -05:00
|
|
|
*/
|
2016-11-14 17:43:44 -06:00
|
|
|
public function join(): Promise;
|
2015-08-27 13:06:39 -05:00
|
|
|
}
|