[icinga-checkins] icinga.org: icinga2/master: Release checker mutex before writing log message.

git at icinga.org git at icinga.org
Wed Mar 27 16:27:56 CET 2013


Module: icinga2
Branch: master
Commit: 1375c64ad9791a383662677358fc84ecf2d776a2
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=1375c64ad9791a383662677358fc84ecf2d776a2

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Wed Mar 27 15:26:56 2013 +0000

Release checker mutex before writing log message.

---

 components/checker/checkercomponent.cpp |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp
index 8865381..6cbd209 100644
--- a/components/checker/checkercomponent.cpp
+++ b/components/checker/checkercomponent.cpp
@@ -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() + "'");





More information about the icinga-checkins mailing list