diff --git a/src/pocketmine/utils/MainLogger.php b/src/pocketmine/utils/MainLogger.php index ce97ac373..a55d15c19 100644 --- a/src/pocketmine/utils/MainLogger.php +++ b/src/pocketmine/utils/MainLogger.php @@ -278,8 +278,10 @@ class MainLogger extends \AttachableThreadedLogger{ * @return void */ public function shutdown(){ - $this->shutdown = true; - $this->notify(); + $this->synchronized(function() : void{ + $this->shutdown = true; + $this->notify(); + }); } /** @@ -368,7 +370,9 @@ class MainLogger extends \AttachableThreadedLogger{ while(!$this->shutdown){ $this->writeLogStream($logResource); $this->synchronized(function() : void{ - $this->wait(); + if(!$this->shutdown){ + $this->wait(); + } }); }