Fix a 100% CPU core usage is some editing cases.

In commit 7cb754dd a call to wxMilliSleep(50) was removed (because it created
lag in editing) but this removal created a 100% CPU core usage.
Using a much small sleep time (1ms) fixes these issues.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17979
This commit is contained in:
jean-pierre charras 2024-05-11 12:53:04 +02:00
parent 814e54af9b
commit e51316a932
1 changed files with 5 additions and 1 deletions

View File

@ -363,7 +363,11 @@ bool TOOL_MANAGER::doRunAction( const TOOL_ACTION& aAction, bool aNow, const std
while( synchronousControl == STS_RUNNING ) while( synchronousControl == STS_RUNNING )
{ {
wxYield(); wxYield(); // Needed to honor mouse (and other) events during editing
wxMilliSleep( 1 ); // Needed to avoid 100% use of one cpu core.
// The sleeping time must be must be small to avoid
// noticeable lag in mouse and editing events
// (1 to 5 ms is a good value)
} }
retVal = synchronousControl != STS_CANCELLED; retVal = synchronousControl != STS_CANCELLED;