mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
Ladybird: Don't burn 100% CPU in EventLoopPluginQt::spin_until()
There's no point in busy-waiting for the condition to come true. By passing the `WaitForMoreEvents` flag to `processEvents()`, we allow Qt to block until it has something for us to react to. This was extremely noticeable when waiting for large resources to finish loading.
This commit is contained in:
parent
bc6a6190d8
commit
ef553a4b76
1 changed files with 1 additions and 1 deletions
|
@ -21,7 +21,7 @@ EventLoopPluginQt::~EventLoopPluginQt() = default;
|
|||
void EventLoopPluginQt::spin_until(Function<bool()> goal_condition)
|
||||
{
|
||||
while (!goal_condition())
|
||||
QCoreApplication::processEvents();
|
||||
QCoreApplication::processEvents(QEventLoop::ProcessEventsFlag::AllEvents | QEventLoop::ProcessEventsFlag::WaitForMoreEvents);
|
||||
}
|
||||
|
||||
void EventLoopPluginQt::deferred_invoke(Function<void()> function)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue