mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Implemented new Inventory windows on Player, Chest and Furnace
This commit is contained in:
@ -52,8 +52,9 @@ abstract class AsyncTask extends \Threaded{
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResult(){
|
||||
return $this->synchronized(function(){
|
||||
return $this->synchronized(function (){
|
||||
$this->finished = true;
|
||||
|
||||
return @unserialize($this->result);
|
||||
});
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class AsyncWorker extends \Worker{
|
||||
|
||||
public function start($options = PTHREADS_INHERIT_CLASSES){
|
||||
$this->path = \pocketmine\PATH;
|
||||
|
||||
return parent::start($options & ~PTHREADS_INHERIT_CLASSES);
|
||||
}
|
||||
|
||||
|
@ -205,11 +205,13 @@ class ServerScheduler{
|
||||
}
|
||||
|
||||
if($this->asyncTasks > 0){ //Garbage collector
|
||||
$this->asyncPool->collect(function(AsyncTask $task){
|
||||
$this->asyncPool->collect(function (AsyncTask $task){
|
||||
if($task->isCompleted() or ($task->isFinished() and !$task->hasResult())){
|
||||
--$this->asyncTasks;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user