mirror of
https://github.com/danog/parallel.git
synced 2024-11-27 04:44:56 +01:00
f48066eb1b
Forking is just too dangerous for virtually no gain over Process. Context now extends Sync\Channel.
31 lines
640 B
PHP
31 lines
640 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel;
|
|
|
|
use Amp\Promise;
|
|
|
|
interface Context extends Sync\Channel {
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isRunning(): bool;
|
|
|
|
/**
|
|
* Starts the execution context.
|
|
*/
|
|
public function start();
|
|
|
|
/**
|
|
* Immediately kills the context.
|
|
*/
|
|
public function kill();
|
|
|
|
/**
|
|
* @return \Amp\Promise<mixed> Resolves with the returned from the context.
|
|
*
|
|
* @throws \Amp\Parallel\ContextException If the context dies unexpectedly.
|
|
* @throws \Amp\Parallel\PanicError If the context throws an uncaught exception.
|
|
*/
|
|
public function join(): Promise;
|
|
}
|