mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
AsyncWorker: added removeFromThreadStore()
and use it instead of overwriting with null things, which still occupies memory
This commit is contained in:
@ -151,6 +151,18 @@ abstract class AsyncTask extends Collectable{
|
||||
$this->worker->saveToThreadStore($identifier, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AsyncWorker::removeFromThreadStore()
|
||||
*
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function removeFromThreadStore(string $identifier) : void{
|
||||
if($this->worker === null or $this->isGarbage()){
|
||||
throw new \BadMethodCallException("Objects can only be removed from AsyncWorker thread-local storage during task execution");
|
||||
}
|
||||
$this->worker->removeFromThreadStore($identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions to execute when run
|
||||
*
|
||||
|
Reference in New Issue
Block a user