use a sleep instead of a yield waiting for close event

This commit is contained in:
Stephen Birarda 2017-06-01 17:57:23 -07:00 committed by Chris Collins
parent e3d8229abe
commit d89febac71

View file

@ -11,6 +11,7 @@
#include "Application.h" #include "Application.h"
#include <chrono>
#include <thread> #include <thread>
#include <gl/Config.h> #include <gl/Config.h>
@ -1747,8 +1748,8 @@ Application::~Application() {
// make sure that the quit event has finished sending before we take the application down // make sure that the quit event has finished sending before we take the application down
auto closeEventSender = DependencyManager::get<CloseEventSender>(); auto closeEventSender = DependencyManager::get<CloseEventSender>();
while (!closeEventSender->hasFinishedQuitEvent() && !closeEventSender->hasTimedOutQuitEvent()) { while (!closeEventSender->hasFinishedQuitEvent() && !closeEventSender->hasTimedOutQuitEvent()) {
// yield so we're not spinning // sleep a little so we're not spinning at 100%
std::this_thread::yield(); std::this_thread::sleep_for(std::chrono::milliseconds(10));
} }
// quit the thread used by the closure event sender // quit the thread used by the closure event sender
closeEventSender->thread()->quit(); closeEventSender->thread()->quit();