1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-27 12:54:55 +01:00

Exit thread if creating the channel fails

This commit is contained in:
Aaron Piotrowski 2016-01-27 00:54:51 -06:00
parent 61c8bdd44d
commit 286003fa17

View File

@ -78,7 +78,12 @@ class Thread extends \Thread
Loop\loop($loop = Loop\create(false)); // Disable signals in thread.
// At this point, the thread environment has been prepared so begin using the thread.
$channel = new ChannelledStream(new DuplexPipe($this->socket, false));
try {
$channel = new ChannelledStream(new DuplexPipe($this->socket, false));
} catch (\Exception $exception) {
return; // Parent has destroyed Thread object, so just exit.
}
$coroutine = new Coroutine($this->execute($channel));
$coroutine->done();