提交 e11a77cb 编写于 作者: Y Yannick Verdie

use sleep instead of usleep on window

上级 f2971aeb
......@@ -230,6 +230,8 @@ CV_IMPL int cvWaitKey( int arg )
if (arg>0)
timer.start(arg);
//QMutex dummy;
while(!guiMainThread._bTimeOut)
{
qApp->processEvents(QEventLoop::AllEvents);
......@@ -245,9 +247,25 @@ CV_IMPL int cvWaitKey( int arg )
mutexKey.unlock();
if (result!=-1)
{
break;
}
else
{
/*
* //will not work, I broke the event loop !!!!
dummy.lock();
QWaitCondition waitCondition;
waitCondition.wait(&dummy, 2);
*/
#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
sleep(2);
#else
usleep(2);//to decrease CPU usage
#endif
}
}
guiMainThread._bTimeOut = false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册