mirror of
https://github.com/danog/amp.git
synced 2024-11-27 12:35:02 +01:00
21 lines
589 B
PHP
21 lines
589 B
PHP
<?php
|
|
|
|
namespace Amp;
|
|
|
|
class Pause extends Unresolved {
|
|
public function __construct(int $millisecondTimeout, Reactor $reactor = null) {
|
|
if ($millisecondTimeout < 1) {
|
|
throw new \DomainException(
|
|
sprintf(
|
|
"Pause millisecond timeout must be greater than or equal to 1; %d provided",
|
|
$millisecondTimeout
|
|
)
|
|
);
|
|
}
|
|
if (empty($reactor)) {
|
|
$reactor = getReactor();
|
|
}
|
|
$reactor->once(function() { $this->resolve(); }, $millisecondTimeout);
|
|
}
|
|
}
|