Skip to content
Snippets Groups Projects
Commit 3b76ec41 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 RadosStriperPool class,
replaced std::mutex and std::lock_guard by
threading::Mutex and threading::MutexLocker.
parent 4ef0d06c
No related branches found
No related tags found
No related merge requests found
......@@ -17,8 +17,10 @@
*/
#include "RadosStriperPool.hpp"
#include <stdexcept>
#include "common/exception/Errnum.hpp"
#include "common/threading/MutexLocker.hpp"
#include <stdexcept>
namespace {
//------------------------------------------------------------------------------
......@@ -71,7 +73,7 @@ unsigned int RadosStriperPool::getStriperIdxAndIncrease() {
// RadosStriperPool::throwingGetStriper
//------------------------------------------------------------------------------
libradosstriper::RadosStriper* RadosStriperPool::throwingGetStriper(const std::string& userAtPool) {
std::lock_guard<std::mutex> lock{m_mutex};
cta::threading::MutexLocker locker{m_mutex};
unsigned int striperIdx = getStriperIdxAndIncrease();
try {
return m_stripers[striperIdx].at(userAtPool);
......@@ -145,7 +147,7 @@ RadosStriperPool::~RadosStriperPool() {
// RadosStriperPool::disconnectAll
//------------------------------------------------------------------------------
void RadosStriperPool::disconnectAll() {
std::lock_guard<std::mutex> lock{m_mutex};
cta::threading::MutexLocker locker{m_mutex};
for (auto v = m_stripers.begin(); v != m_stripers.end(); v++) {
for (auto i = v->begin(); i != v->end(); i++) {
delete i->second;
......
......@@ -18,11 +18,11 @@
#pragma once
#include "common/threading/Mutex.hpp"
#include <radosstriper/libradosstriper.hpp>
#include <map>
#include <memory>
#include <mutex>
namespace castor {
namespace tape {
......@@ -71,7 +71,7 @@ private:
/// striper pool
std::vector<StriperDict> m_stripers;
/// mutex protecting the striper pool
std::mutex m_mutex;
cta::threading::Mutex m_mutex;
/// size of the Striper pool
unsigned int m_maxStriperIdx;
/// index of current striper pool to be used
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment