mirror of
https://github.com/danog/asyncConstruct.git
synced 2024-11-30 04:18:58 +01:00
25 lines
425 B
PHP
25 lines
425 B
PHP
<?php
|
|
|
|
namespace danog\Test\Fixtures;
|
|
|
|
use danog\BlockingWakeup;
|
|
|
|
use function Amp\delay;
|
|
|
|
class BlockingWakeupTest
|
|
{
|
|
use BlockingWakeup;
|
|
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;
|
|
}
|
|
}
|