mirror of
https://github.com/danog/asyncConstruct.git
synced 2024-12-03 09:47:45 +01:00
25 lines
423 B
PHP
25 lines
423 B
PHP
<?php
|
|
|
|
namespace danog\Test\Fixtures;
|
|
|
|
use danog\AsyncWakeup as AWakeup;
|
|
|
|
use function Amp\delay;
|
|
|
|
class AsyncWakeupTest
|
|
{
|
|
use AWakeup;
|
|
public $woke = false;
|
|
private $delay;
|
|
public function __construct(int $delay)
|
|
{
|
|
$this->delay = $delay;
|
|
}
|
|
protected function __wakeup_async(): \Generator
|
|
{
|
|
yield delay($this->delay);
|
|
$this->woke = true;
|
|
return true;
|
|
}
|
|
}
|