Skip to content
Snippets Groups Projects
Commit 11f3e2e5 authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'thread.CxxUtils-20190107' into 'master'

CxxUtils: Fix thread-safety checker warnings.

See merge request atlas/athena!20200
parents bb847359 16b226d0
No related branches found
No related tags found
No related merge requests found
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
......@@ -124,6 +124,8 @@
* Add to a function to suppress warnings about uses of static variables,
* mutable variables, or discarding const.
*
* Add to a class to so mark all functions in the class.
*
* A function calling an ATLAS_NOT_THREAD_SAFE function must also be marked
* ATLAS_NOT_THREAD_SAFE.
*/
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/**
......@@ -22,6 +22,7 @@
#include "CxxUtils/SealDebug.h" // wlav
#include "CxxUtils/SealSignal.h" // wlav
#include "CxxUtils/SealSharedLib.h" // wlav
#include "CxxUtils/checker_macros.h"
// wlav copied from SealBase/sysapi/DebugAids.h
#include <cstring>
......@@ -116,7 +117,7 @@ namespace {
std::string addr2LinePath = "/usr/bin/addr2line";
struct BacktraceInit
struct ATLAS_NOT_THREAD_SAFE BacktraceInit
{
BacktraceInit()
{
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
......@@ -21,6 +21,7 @@
#include <execinfo.h>
#include <cstdio>
#include <typeinfo>
#include "CxxUtils/checker_macros.h"
// Maximum stack depth.
static
......@@ -50,7 +51,7 @@ extern "C" void __cxa_throw (void* thrown_exception,
namespace CxxUtils {
struct extrace_init
struct ATLAS_NOT_THREAD_SAFE extrace_init
{
extrace_init();
};
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
/*
*/
......@@ -791,13 +791,14 @@ public:
struct const_iterator
: public ck_hs_iterator_t
{
const_iterator(const ck_hs_t* hs) : m_hs (const_cast<ck_hs_t*>(hs))
const_iterator(const ck_hs_t* hs) : m_hs (hs)
{ cursor = nullptr; offset = 0; }
const_iterator() : const_iterator(nullptr) {}
size_t operator* () const { return reinterpret_cast<size_t> (m_elt); }
const_iterator& operator++()
{
if (!ck_hs_next (m_hs, this, &m_elt)) {
ck_hs_t* hs_nc ATLAS_THREAD_SAFE = const_cast<ck_hs_t*> (m_hs);
if (!ck_hs_next (hs_nc, this, &m_elt)) {
cursor = nullptr;
offset = 0;
}
......@@ -813,7 +814,7 @@ public:
return !(*this == other);
}
ck_hs_t* m_hs;
const ck_hs_t* m_hs;
void* m_elt = nullptr;
};
......@@ -863,7 +864,8 @@ CKHSAdapter::CKHSAdapter (const CKHSAdapter& other)
{
ck_hs_iterator it { nullptr, 0};
void* obj;
while (ck_hs_next (const_cast<ck_hs_t*>(&other.m_hs), &it, &obj)) {
ck_hs_t* hs_nc ATLAS_THREAD_SAFE = const_cast<ck_hs_t*>(&other.m_hs);
while (ck_hs_next (hs_nc, &it, &obj)) {
insert (reinterpret_cast<size_t> (obj));
}
}
......
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