Check for jobs using predicate

pull/541/head
elsid 6 years ago
parent c05fc9e054
commit ece111d05a
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -162,9 +162,7 @@ namespace DetourNavigator
boost::optional<AsyncNavMeshUpdater::Job> AsyncNavMeshUpdater::getNextJob()
{
std::unique_lock<std::mutex> 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();

Loading…
Cancel
Save