8000 [Process] Adds usleep(1000) to ease CPU usage. by miniyarov · Pull Request #28940 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Process] Adds usleep(1000) to ease CPU usage. #28940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Symfony/Component/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,10 @@ public function wait(callable $callback = null)
* from the output in real-time while writing the standard input to the process.
* It allows to have feedback from the independent process during execution.
*
* @param callable $callback
*
* @throws RuntimeException When process timed out
* @throws LogicException When process is not yet started
*/
public function waitUntil(callable $callback)
public function waitUntil(callable $callback): bool
{
$this->requireProcessIsStarted(__FUNCTION__);
$this->updateStatus(false);
Expand All @@ -465,7 +463,14 @@ public function waitUntil(callable $callback)
$this->fallbackStatus['exitcode'] = (int) $data;
}
}
if ($wait && !$this->isRunning()) {
return false;
}

usleep(1000);
} while ($wait);

return true;
}

/**
Expand Down
0