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

32 lines
696 B
PHP
Raw Normal View History

2016-12-30 02:16:04 +01:00
<?php
2015-08-27 16:10:08 +02:00
2017-12-08 04:26:55 +01:00
namespace Amp\Parallel\Context;
2016-08-18 18:04:48 +02:00
2017-12-08 04:26:55 +01:00
use Amp\Parallel\Sync\Channel;
use Amp\Promise;
2016-08-18 18:04:48 +02:00
2017-12-08 04:26:55 +01:00
interface Context extends 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(): Promise;
2015-08-27 16:10:08 +02:00
/**
* Immediately kills the context.
*/
public function kill();
/**
* @return \Amp\Promise<mixed> Resolves with the returned from the context.
*
2017-12-08 04:26:55 +01: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 16:10:08 +02:00
*/
2016-11-15 00:43:44 +01:00
public function join(): Promise;
}