39 public function __construct(
42 private int $memoryLimit,
47 if(self::$notifier !==
null){
48 return self::$notifier;
53 public static function maybeCollectCycles() :
void{
54 if(self::$cycleGcManager ===
null){
57 self::$cycleGcManager->maybeCollectCycles();
60 protected function onRun() :
void{
61 \GlobalLogger::set($this->logger);
63 if($this->memoryLimit > 0){
64 ini_set(
'memory_limit', $this->memoryLimit .
'M');
65 $this->logger->debug(
"Set memory limit to " . $this->memoryLimit .
" MB");
67 ini_set(
'memory_limit',
'-1');
68 $this->logger->debug(
"No memory limit set");
71 self::$notifier = $this->sleeperEntry->createNotifier();
80 public function getThreadName() :
string{
81 return "AsyncWorker#" . $this->id;
84 public function getAsyncWorkerId() :
int{