2016-12-30 02:16:04 +01:00
|
|
|
<?php
|
2015-08-27 16:10:08 +02:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel;
|
2016-08-18 18:04:48 +02:00
|
|
|
|
2017-03-16 23:03:59 +01:00
|
|
|
use Amp\Promise;
|
2016-08-18 18:04:48 +02:00
|
|
|
|
2017-11-10 16:58:42 +01:00
|
|
|
interface Context extends Sync\Channel {
|
2015-08-27 16:10:08 +02:00
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
2016-01-23 07:00:56 +01:00
|
|
|
public function isRunning(): bool;
|
2015-08-27 16:10:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts the execution context.
|
|
|
|
*/
|
|
|
|
public function start();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Immediately kills the context.
|
|
|
|
*/
|
|
|
|
public function kill();
|
|
|
|
|
|
|
|
/**
|
2017-03-16 23:03:59 +01:00
|
|
|
* @return \Amp\Promise<mixed> Resolves with the returned from the context.
|
2017-03-09 23:15:30 +01:00
|
|
|
*
|
|
|
|
* @throws \Amp\Parallel\ContextException If the context dies unexpectedly.
|
|
|
|
* @throws \Amp\Parallel\PanicError If the context throws an uncaught exception.
|
2015-08-27 16:10:08 +02:00
|
|
|
*/
|
2016-11-15 00:43:44 +01:00
|
|
|
public function join(): Promise;
|
2015-08-27 20:06:39 +02:00
|
|
|
}
|