Fix race condition for concurrent_checks

fixes #11932
This commit is contained in:
Gunnar Beutner 2016-08-29 14:12:29 +02:00
parent 0a76921086
commit 3d1490529f
1 changed files with 4 additions and 0 deletions

View File

@ -193,6 +193,8 @@ void CheckerComponent::CheckThreadProc(void)
Log(LogDebug, "CheckerComponent") Log(LogDebug, "CheckerComponent")
<< "Executing check for '" << checkable->GetName() << "'"; << "Executing check for '" << checkable->GetName() << "'";
Checkable::IncreasePendingChecks();
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, CheckerComponent::Ptr(this), checkable)); Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, CheckerComponent::Ptr(this), checkable));
lock.lock(); lock.lock();
@ -221,6 +223,8 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
Log(LogCritical, "checker", output); Log(LogCritical, "checker", output);
} }
Checkable::DecreasePendingChecks();
{ {
boost::mutex::scoped_lock lock(m_Mutex); boost::mutex::scoped_lock lock(m_Mutex);