usleep
brefphp/bref
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Delay execution in microseconds
usleep
(
int $microseconds
):
void
$animation
= new
LoadingAnimation
(
$io
);
do {
$animation
->
tick
(
'Retrieving the stack'
);
usleep
(
100
*
1000
);
} while (
$serverlessInfo
->
isRunning
());
$animation
->
clear
();
src/Console/Command/Dashboard.php
$dockerPull
->
start
();
do {
$animation
->
tick
(
'Retrieving the latest version of the dashboard'
);
usleep
(
100
*
1000
);
} while (
$dockerPull
->
isRunning
());
$animation
->
clear
();
if (!
$dockerPull
->
isSuccessful
()) {
src/Console/Command/Dashboard.php
$process
->
start
();
do {
$animation
->
tick
(
'Starting the dashboard'
);
usleep
(
100
*
1000
);
$serverOutput
=
$process
->
getOutput
() .
$process
->
getErrorOutput
();
$hasStarted
= (
strpos
(
$serverOutput
,
'Development Server'
) !==
false
);
} while (
$process
->
isRunning
() && !
$hasStarted
);
src/Console/Command/Dashboard.php
$elapsed
=
0
;
while (!
$this
->
isReady
()) {
usleep
(
$wait
);
$elapsed
+=
$wait
;
if (
$elapsed
>
$timeout
) {
src/Event/Http/FpmHandler.php
$timeout
=
1000000
;
// 1 sec
$elapsed
=
0
;
while (
posix_getpgid
(
$pid
) !==
false
) {
usleep
(
$wait
);
$elapsed
+=
$wait
;
if (
$elapsed
>
$timeout
) {
throw new
Exception
(
'Timeout while waiting for PHP-FPM to stop'
);
src/Event/Http/FpmHandler.php
if (isset(
$event
[
'warmer'
]) &&
$event
[
'warmer'
] ===
true
) {
usleep
(
10000
);
// 10ms
return [
'Lambda is warm'
];
}
src/Event/Http/HttpHandler.php
{
$tries
=
0
;
while (!
self
::
isListening
() && ++
$tries
<
$maxTries
) {
usleep
(
100000
);
}
if (!
self
::
isListening
()) {
throw new
\RuntimeException
(
'Unable to contact node.js server'
);
tests/Server.php