Skip to content
Snippets Groups Projects
Commit e335611c 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 mediachanger::ZmqContextSingleton class.
Replaced std::mutex and std::lock_guard with their helgrind
friendly drop in replacements threading::Mutex and
threading::MutexLocker.
parent 6a281caf
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
#include "ZmqContextSingleton.hpp"
#include "common/exception/Exception.hpp"
#include "common/threading/MutexLocker.hpp"
#include "common/utils/utils.hpp"
#include <zmq.h>
......@@ -28,7 +29,7 @@ namespace mediachanger {
//------------------------------------------------------------------------------
// s_mutex
//------------------------------------------------------------------------------
std::mutex ZmqContextSingleton::s_mutex;
threading::Mutex ZmqContextSingleton::s_mutex;
//------------------------------------------------------------------------------
// s_instance
......@@ -40,7 +41,7 @@ void *ZmqContextSingleton::s_instance = nullptr;
//------------------------------------------------------------------------------
void *ZmqContextSingleton::instance() {
try {
std::lock_guard<std::mutex> lock(s_mutex);
threading::MutexLocker locker(s_mutex);
if(nullptr == s_instance) {
const int sizeOfIOThreadPoolForZMQ = 1;
......
......@@ -18,8 +18,9 @@
#pragma once
#include "common/threading/Mutex.hpp"
#include <memory>
#include <mutex>
namespace cta {
namespace mediachanger {
......@@ -62,7 +63,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 a ZMQ context. A value of NULL means the ZMQ
......
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