mirror of
https://github.com/danog/amp.git
synced 2024-12-14 02:17:26 +01:00
21 lines
593 B
PHP
21 lines
593 B
PHP
<?php
|
|
|
|
namespace Amp;
|
|
|
|
class Pause extends PrivatePlaceholder {
|
|
public function __construct($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);
|
|
}
|
|
}
|