Skip to content

AsyncWorker ​

class · pocketmine\scheduler\AsyncWorker · source

Extends Worker

Methods ​

__construct() ​

php
public function __construct(\pocketmine\thread\log\ThreadSafeLogger $logger, int $id, int $memoryLimit, \pocketmine\snooze\SleeperHandlerEntry $sleeperEntry)

getAsyncWorkerId() ​

php
public function getAsyncWorkerId() : int

getFromThreadStore() ​

php
public function getFromThreadStore(string $identifier) : mixed

Deprecated

Use static class properties instead.

Retrieves mixed data from the worker's thread-local object store.

Note that the thread-local object store could be cleared and your data might not exist, so your code should account for the possibility that what you're trying to retrieve might not exist.

Objects stored in this storage may ONLY be retrieved while the task is running.

getLogger() ​

php
public function getLogger() : \pocketmine\thread\log\ThreadSafeLogger

getNotifier() ​

php
public static function getNotifier() : \pocketmine\snooze\SleeperNotifier

getThreadName() ​

php
public function getThreadName() : string

maybeCollectCycles() ​

php
public static function maybeCollectCycles() : void

onRun() protected ​

php
protected function onRun() : void

removeFromThreadStore() ​

php
public function removeFromThreadStore(string $identifier) : void

Deprecated

Use static class properties instead.

Removes previously-stored mixed data from the worker's thread-local object store.

saveToThreadStore() ​

php
public function saveToThreadStore(string $identifier, mixed $value) : void

Deprecated

Use static class properties instead.

Saves mixed data into the worker's thread-local object store. This can be used to store objects which you want to use on this worker thread from multiple AsyncTasks.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.