RemotePlugin: sleep in waitForMessage() when actively waiting for data
RemotePlugin::waitForMessage() can operate in polling mode which is used when loading a remote plugin so the master application does not block until the remote plugin has been loaded. This is achieved by calling QCoreApplication::processEvents(). However if there're no events to process, the polling loop will just eat up CPU time which is especially bad when on a single core system. This has been fixed by inserting short sleeps.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <cassert>
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
#include <windows.h>
|
||||
#define USE_QT_SEMAPHORES
|
||||
#define USE_QT_SHMEM
|
||||
#endif
|
||||
@@ -966,6 +967,11 @@ RemotePluginBase::message RemotePluginBase::waitForMessage(
|
||||
{
|
||||
QCoreApplication::processEvents(
|
||||
QEventLoop::ExcludeUserInputEvents, 50 );
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
Sleep( 5 );
|
||||
#else
|
||||
usleep( 5 * 1000 );
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user