mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 15:35:31 +00:00
Clean up pointless checks in Thread/Worker
This commit is contained in:
parent
c684f99cc4
commit
1b053c7928
@ -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.
|
||||||
*/
|
*/
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user