From ece111d05a238b4b49d810eef878298d6665156d Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 19 Feb 2019 03:05:15 +0300 Subject: [PATCH] Check for jobs using predicate --- components/detournavigator/asyncnavmeshupdater.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/detournavigator/asyncnavmeshupdater.cpp b/components/detournavigator/asyncnavmeshupdater.cpp index e9172f041..bb2605a5b 100644 --- a/components/detournavigator/asyncnavmeshupdater.cpp +++ b/components/detournavigator/asyncnavmeshupdater.cpp @@ -162,9 +162,7 @@ namespace DetourNavigator boost::optional AsyncNavMeshUpdater::getNextJob() { std::unique_lock lock(mMutex); - if (mJobs.empty()) - mHasJob.wait_for(lock, std::chrono::milliseconds(10)); - if (mJobs.empty()) + if (!mHasJob.wait_for(lock, std::chrono::milliseconds(10), [&] { return !mJobs.empty(); })) { mFirstStart.lock()->reset(); mDone.notify_all();