Skip to content
Snippets Groups Projects
Commit b240e06d authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#130 Helgrind gets spurious when using `std::mutex` in the catalogue.

With respect to the rdbms::OcciEnvSingleton class. Replaced
std::mutex and std::lock_guard with their helgrind friendly
drop in replacements threading::Mutex and
threading::MutexLocker.
parent 1947b765
No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OcciEnvSingleton.hpp"
#include "rdbms/OcciEnvSingleton.hpp"
#include "common/exception/Exception.hpp"
#include "common/threading/MutexLocker.hpp"
namespace cta {
namespace rdbms {
......@@ -25,7 +26,7 @@ namespace rdbms {
//------------------------------------------------------------------------------
// s_mutex
//------------------------------------------------------------------------------
std::mutex OcciEnvSingleton::s_mutex;
threading::Mutex OcciEnvSingleton::s_mutex;
//------------------------------------------------------------------------------
// s_instance
......@@ -37,7 +38,7 @@ std::unique_ptr<OcciEnvSingleton> OcciEnvSingleton::s_instance;
//------------------------------------------------------------------------------
OcciEnvSingleton &OcciEnvSingleton::instance() {
try {
std::lock_guard<std::mutex> lock(s_mutex);
threading::MutexLocker locker(s_mutex);
if(nullptr == s_instance.get()) {
s_instance.reset(new OcciEnvSingleton());
......
......@@ -18,10 +18,10 @@
#pragma once
#include "OcciEnv.hpp"
#include "common/threading/Mutex.hpp"
#include "rdbms/OcciEnv.hpp"
#include <memory>
#include <mutex>
namespace cta {
namespace rdbms {
......@@ -43,7 +43,7 @@ private:
* Mutex used to implement a critical region around the implementation of the
* instance() method.
*/
static std::mutex s_mutex;
static threading::Mutex s_mutex;
/**
* The single instance of this class.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment