Commit 051c3f88 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 GetOptThreadSafe class,
replaced std::mutex and std::lock_guard by
threading::Mutex and threading::MutexLocker.
parent 26857635
......@@ -18,13 +18,14 @@
#include "GetOptThreadSafe.hpp"
#include "common/exception/Exception.hpp"
#include "common/threading/MutexLocker.hpp"
#include <memory>
namespace cta { namespace utils {
GetOpThreadSafe::Reply GetOpThreadSafe::getOpt(const Request& request) {
std::lock_guard<std::mutex> lock(gMutex);
threading::MutexLocker locker(gMutex);
// Prepare the classic styled argv.
std::unique_ptr<char * []>argv(new char *[request.argv.size()]);
char ** p=argv.get();
......@@ -71,6 +72,6 @@ GetOpThreadSafe::Reply GetOpThreadSafe::getOpt(const Request& request) {
return ret;
}
std::mutex GetOpThreadSafe::gMutex;
threading::Mutex GetOpThreadSafe::gMutex;
}} // namespace cta::utils
\ No newline at end of file
}} // namespace cta::utils
......@@ -16,11 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/threading/Mutex.hpp"
#include <vector>
#include <string>
#include <unistd.h>
#include <getopt.h>
#include <mutex>
namespace cta { namespace utils {
......@@ -45,7 +46,7 @@ public:
};
static Reply getOpt (const Request & request);
private:
static std::mutex gMutex;
static threading::Mutex gMutex;
};
}} // namespace cta::utils
\ No newline at end of file
}} // namespace cta::utils
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment