Clean up pointless checks in Thread/Worker

This commit is contained in:
Dylan K. Taylor 2018-07-26 14:20:55 +01:00
parent c684f99cc4
commit 1b053c7928
2 changed files with 6 additions and 14 deletions

View File

@ -67,16 +67,12 @@ abstract class Thread extends \Thread{
public function start(?int $options = \PTHREADS_INHERIT_ALL){ public function start(?int $options = \PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this); ThreadManager::getInstance()->add($this);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){ if($this->getClassLoader() === null){
$this->setClassLoader(); $this->setClassLoader();
} }
return parent::start($options); return parent::start($options);
} }
return false;
}
/** /**
* Stops the thread using the best way possible. Try to stop it yourself before calling this. * Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/ */

View File

@ -67,16 +67,12 @@ abstract class Worker extends \Worker{
public function start(?int $options = \PTHREADS_INHERIT_ALL){ public function start(?int $options = \PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this); ThreadManager::getInstance()->add($this);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){ if($this->getClassLoader() === null){
$this->setClassLoader(); $this->setClassLoader();
} }
return parent::start($options); return parent::start($options);
} }
return false;
}
/** /**
* Stops the thread using the best way possible. Try to stop it yourself before calling this. * Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/ */