Index: programs/mythfrontend/networkcontrol.h =================================================================== --- programs/mythfrontend/networkcontrol.h (revision 13501) +++ programs/mythfrontend/networkcontrol.h (working copy) @@ -11,6 +11,7 @@ #include #include #include +#include class MainServer; @@ -62,6 +63,7 @@ QValueList networkControlCommands; QMutex ncLock; + QWaitCondition ncCond; QValueList networkControlReplies; QMutex nrLock; Index: programs/mythfrontend/networkcontrol.cpp =================================================================== --- programs/mythfrontend/networkcontrol.cpp (revision 13501) +++ programs/mythfrontend/networkcontrol.cpp (working copy) @@ -212,31 +212,21 @@ void NetworkControl::RunCommandThread(void) { QString command; - int commands = 0; for (;;) { pthread_testcancel(); ncLock.lock(); - commands = networkControlCommands.size(); + while (!networkControlCommands.size()) { + ncCond.wait(&ncLock); + pthread_testcancel(); + } + command = networkControlCommands.front(); + networkControlCommands.pop_front(); ncLock.unlock(); - while (commands) - { - ncLock.lock(); - command = networkControlCommands.front(); - networkControlCommands.pop_front(); - ncLock.unlock(); - - processNetworkControlCommand(command); - - ncLock.lock(); - commands = networkControlCommands.size(); - ncLock.unlock(); - } - - usleep(50000); + processNetworkControlCommand(command); } } @@ -341,6 +331,7 @@ ncLock.lock(); networkControlCommands.push_back(lineIn); + ncCond.wakeOne(); ncLock.unlock(); } }