AsyncWorker: added removeFromThreadStore()

and use it instead of overwriting with null things, which still occupies memory
This commit is contained in:
Dylan K. Taylor
2018-06-07 10:12:50 +01:00
parent ee787974f2
commit b331f8e1c9
3 changed files with 23 additions and 2 deletions

View File

@ -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
*