From 42d91ec0bbeb4df77e9be577279fb0c2c11582f5 Mon Sep 17 00:00:00 2001
From: Marco De Marco <demarco@oats.inaf.it>
Date: Tue, 13 May 2014 16:10:49 +0200
Subject: [PATCH] Counters readed without mutex lock fix

---
 src/PreProcessor.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/PreProcessor.cpp b/src/PreProcessor.cpp
index cd898dc..6cfbe42 100644
--- a/src/PreProcessor.cpp
+++ b/src/PreProcessor.cpp
@@ -436,6 +436,9 @@ void PreProcessor::read_RegularFileCounter(Tango::Attribute &attr)
 	DEBUG_STREAM << "PreProcessor::read_RegularFileCounter(Tango::Attribute &attr) entering... " << endl;
 	/*----- PROTECTED REGION ID(PreProcessor::read_RegularFileCounter) ENABLED START -----*/
 	//	Set the attribute value
+
+	boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex);
+
 	attr.set_value(attr_RegularFileCounter_read);
 
 	/*----- PROTECTED REGION END -----*/	//	PreProcessor::read_RegularFileCounter
@@ -454,6 +457,9 @@ void PreProcessor::read_WarningFileCounter(Tango::Attribute &attr)
 	DEBUG_STREAM << "PreProcessor::read_WarningFileCounter(Tango::Attribute &attr) entering... " << endl;
 	/*----- PROTECTED REGION ID(PreProcessor::read_WarningFileCounter) ENABLED START -----*/
 	//	Set the attribute value
+
+	boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex);
+
 	attr.set_value(attr_WarningFileCounter_read);
 
 	/*----- PROTECTED REGION END -----*/	//	PreProcessor::read_WarningFileCounter
@@ -472,6 +478,9 @@ void PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr)
 	DEBUG_STREAM << "PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr) entering... " << endl;
 	/*----- PROTECTED REGION ID(PreProcessor::read_ErrorFileCounter) ENABLED START -----*/
 	//	Set the attribute value
+
+	boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex);
+
 	attr.set_value(attr_ErrorFileCounter_read);
 
 	/*----- PROTECTED REGION END -----*/	//	PreProcessor::read_ErrorFileCounter
@@ -592,7 +601,7 @@ void PreProcessor::reset_counter()
 //==============================================================================
 void PreProcessor::incrementRegularCounter()
 {
-    DEBUG_STREAM << "FitsImporter::incrementRegularCounter()  - " << device_name << endl;
+    DEBUG_STREAM << "PreProcessor::incrementRegularCounter()  - " << device_name << endl;
 
     boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex);
 
@@ -604,7 +613,7 @@ void PreProcessor::incrementRegularCounter()
 //==============================================================================
 void PreProcessor::incrementWarningCounter()
 {
-    DEBUG_STREAM << "FitsImporter::incrementWarningCounter()  - " << device_name << endl;
+    DEBUG_STREAM << "PreProcessor::incrementWarningCounter()  - " << device_name << endl;
 
     boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex);
 
@@ -616,7 +625,7 @@ void PreProcessor::incrementWarningCounter()
 //==============================================================================
 void PreProcessor::incrementErrorCounter()
 {
-    DEBUG_STREAM << "FitsImporter::incrementErrorCounter()  - " << device_name << endl;
+    DEBUG_STREAM << "PreProcessor::incrementErrorCounter()  - " << device_name << endl;
 
     boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex);
 
-- 
GitLab