mirror of
https://github.com/danog/parallel.git
synced 2025-01-22 14:01:14 +01:00
Exit thread immediately if parent context died while starting
This commit is contained in:
parent
2aa5692fdb
commit
1a6896b047
@ -86,6 +86,10 @@ class Thread extends \Thread {
|
|||||||
return; // Thread killed while requiring autoloader, simply exit.
|
return; // Thread killed while requiring autoloader, simply exit.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!\is_resource($this->socket) || \feof($this->socket)) {
|
||||||
|
return; // Parent context exited, no need to continue.
|
||||||
|
}
|
||||||
|
|
||||||
Loop::run(function () {
|
Loop::run(function () {
|
||||||
$watcher = Loop::repeat(self::KILL_CHECK_FREQUENCY, function () {
|
$watcher = Loop::repeat(self::KILL_CHECK_FREQUENCY, function () {
|
||||||
if ($this->killed) {
|
if ($this->killed) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user