delay = $delay; } /** * Async wakeup function. * * Typically, one would re-establish an async AMP database connection here, or do some other async stuff. * * @return \Generator */ protected function __wakeup_async(): \Generator { yield delay($this->delay); echo "Woke up after {$this->delay} milliseconds!".PHP_EOL; } } Loop::run(function () { $test = new BlockingWakeupTest(1000); $test = \serialize($test); echo "Deserializing...".PHP_EOL; $test = \unserialize($test); });