]> granicus.if.org Git - icinga2/commitdiff
Release checker mutex before writing log message.
authorGunnar Beutner <gunnar@beutner.name>
Wed, 27 Mar 2013 15:26:56 +0000 (15:26 +0000)
committerGunnar Beutner <gunnar@beutner.name>
Wed, 27 Mar 2013 15:27:45 +0000 (15:27 +0000)
components/checker/checkercomponent.cpp

index 88653811dfbc1ad84de4c9664f501f82163feedb..6cbd209f46f5ff450ef7e0594111da021e8785fb 100644 (file)
@@ -158,17 +158,19 @@ void CheckerComponent::ExecuteCheckHelper(const Service::Ptr& service)
                Log(LogCritical, "checker", "Exception occured while checking service '" + service->GetName() + "': " + boost::diagnostic_information(ex));
        }
 
-       boost::mutex::scoped_lock lock(m_Mutex);
+       {
+               boost::mutex::scoped_lock lock(m_Mutex);
 
-       /* remove the service from the list of pending services; if it's not in the
-        * list this was a manual (i.e. forced) check and we must not re-add the
-        * service to the services list because it's already there. */
-       CheckerComponent::ServiceSet::iterator it;
-       it = m_PendingServices.find(service);
-       if (it != m_PendingServices.end()) {
-               m_PendingServices.erase(it);
-               m_IdleServices.insert(service);
-               m_CV.notify_all();
+               /* remove the service from the list of pending services; if it's not in the
+                * list this was a manual (i.e. forced) check and we must not re-add the
+                * service to the services list because it's already there. */
+               CheckerComponent::ServiceSet::iterator it;
+               it = m_PendingServices.find(service);
+               if (it != m_PendingServices.end()) {
+                       m_PendingServices.erase(it);
+                       m_IdleServices.insert(service);
+                       m_CV.notify_all();
+               }
        }
 
        Log(LogDebug, "checker", "Check finished for service '" + service->GetName() + "'");