Skip to content

Commit

Permalink
Exit thread if creating the channel fails
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Jan 27, 2016
1 parent 61c8bdd commit 286003f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Threading/Internal/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ public function run()
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();
Expand Down

0 comments on commit 286003f

Please sign in to comment.