Skip to content
Snippets Groups Projects
Commit 7aef1c59 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'threadCheck.AthenaKernel-20170915' into 'master'

AthenaKernel: Enable thread-safety checking.

See merge request !4720

Former-commit-id: f4c3ab70
parents 8ff490b3 7d21a7b2
No related branches found
No related tags found
No related merge requests found
Showing
with 45 additions and 63 deletions
......@@ -2,43 +2,32 @@
Initializing Gaudi ApplicationMgr using job opts ../share/DataProxy_test.txt
JobOptionsSvc INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work14/InstallArea/jobOptions/ControlTest/StoreGateTestCommon.txt
JobOptionsSvc INFO # (5,1): ApplicationMgr.ExtSvc += ["StoreGateSvc/DetectorStore", "StoreGateSvc/HistoryStore"]
JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/ControlTest/StoreGateTestCommon.txt
JobOptionsSvc INFO # (5,1): ApplicationMgr.ExtSvc += ["StoreGateSvc/DetectorStore", "StoreGateSvc/HistoryStore", "StoreGateSvc/ConditionsStore"]
JobOptionsSvc INFO # (6,1): AuditorSvc.Auditors += ["AlgContextAuditor"]
JobOptionsSvc INFO # (7,1): StoreGateSvc.OutputLevel = 1
JobOptionsSvc INFO # (8,1): StoreGateSvc.ActivateHistory = 0
JobOptionsSvc INFO # (9,1): CLIDSvc.OutputLevel = 2
JobOptionsSvc INFO # (10,1): MessageSvc.useColors = 1
JobOptionsSvc INFO # =======> /afs/cern.ch/atlas/software/builds/nightlies/mig14/AtlasCore/rel_3/InstallArea/jobOptions/ToyConversion/ToyConversionOpts.txt
JobOptionsSvc INFO # =======> /home/sss/atlas/rootaccess/build/joboptions/ToyConversion/ToyConversionOpts.txt
JobOptionsSvc INFO # (5,1): EventPersistencySvc.CnvServices += ["ToyConversionSvc"]
JobOptionsSvc INFO Job options successfully read in from ../share/DataProxy_test.txt
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v2r1)
running on lxplus0158 on Wed Apr 23 20:31:29 2014
Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
running on karma on Thu Aug 3 19:40:18 2017
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
DetectorStore INFO Initializing DetectorStore - package version StoreGate-02-41-08
ClassIDSvc INFO Initializing ClassIDSvc - package version CLIDComps-00-06-11
ClassIDSvc INFO getRegistryEntries: read 153 CLIDRegistry entries for module ALL
ProxyProviderSvc INFO Initializing ProxyProviderSvc - package version SGComps-00-01-07
HistoryStore INFO Initializing HistoryStore - package version StoreGate-02-41-08
ClassIDSvc INFO getRegistryEntries: read 1913 CLIDRegistry entries for module ALL
EventLoopMgr WARNING Unable to locate service "EventSelector" 
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
Now we expect to see a warning message:
----Warning Message Starts--->>
<<---Warning Message Ends-------
FIXME: in opt 32 bits we need to print the address of addressProxy to avoid a crash when the jobs ends!?! @0x7fff17a40a10
building toy 0xff8ae0
FIXME: in opt 32 bits we need to print the address of addressProxy to avoid a crash when the jobs ends!?! @0x7ffc8985ffb0
EventPersistenc... INFO Added successfully Conversion service:ToyConversionSvc
Now we expect to see a warning message:
----Warning Message Starts--->>
DataProxy WARNING accessData: IOA pointer not set
<<---Warning Message Ends-------
Now we expect to see an warning message:
----Warning Message Starts--->>
<<---Warning Message Ends-------
*** DataProxy_test OK ***
......@@ -67,14 +67,6 @@ int main() {
assert( 0 == emptyProxy.transientID().size() );
assert( emptyProxy.isResetOnly() );
assert( !emptyProxy.isConst() );
try {
cerr << "Now we expect to see a warning message:" << endl
<< "----Warning Message Starts--->>" << endl;
const Bla& bRef(DataProxy_cast<Bla>(emptyProxy));
bRef.doNothing(); //remove warning
} catch (...) {
cerr << "<<---Warning Message Ends-------" << endl;
}
Bla *pBla(new Bla(77));
......@@ -90,7 +82,7 @@ int main() {
assert( transientProxy.transientID().size() == 1);
assert( transientProxy.isResetOnly() );
assert( !transientProxy.isConst() );
assert( (DataProxy_cast<Bla>(transientProxy)).i == 77 );
assert( (DataProxy_cast<Bla>(&transientProxy))->i == 77 );
IConversionSvc* pIConvSvc(nullptr);
......@@ -119,8 +111,8 @@ int main() {
assert( addressProxy.transientID().size() == 1);
assert( addressProxy.isResetOnly() );
assert( !addressProxy.isConst() );
const Foo& fRef(DataProxy_cast<Foo>(addressProxy));
fRef.doNothing(); //remove warning
Foo* fptr(DataProxy_cast<Foo>(&addressProxy));
fptr->doNothing(); //remove warning
IProxyProviderSvc* pIPPSvc(nullptr);
......@@ -147,14 +139,6 @@ int main() {
assert( identifiedProxy.transientID().size() == 1);
assert( identifiedProxy.isResetOnly() );
assert( !identifiedProxy.isConst() );
try {
cerr << "Now we expect to see an warning message:" << endl
<< "----Warning Message Starts--->>" << endl;
const Bla& bRef(DataProxy_cast<Bla>(identifiedProxy));
bRef.doNothing(); //remove warning
} catch (...) {
cerr << "<<---Warning Message Ends-------" << endl;
}
cout << "*** DataProxy_test OK ***" <<endl;
......
......@@ -13,6 +13,7 @@
#include "AthenaKernel/ClassID_traits.h"
#include "CxxUtils/unused.h"
#include "CxxUtils/checker_macros.h"
#include <boost/preprocessor/stringize.hpp>
#ifdef __CLING__
......@@ -70,11 +71,11 @@
static const bool s_isDataObject = isDObj_t::value; \
typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \
typedef std::true_type has_classID_tag; \
static const CLID& ID() { static const CLID c(CID); return c; } \
static const char* typeNameString() { \
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { static const CLID c(CID); return c; } \
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
return #NAME; \
} \
static const std::string& typeName() { \
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
static const std::string name = typeNameString(); \
return name; \
} \
......@@ -110,13 +111,13 @@
static const bool s_isDataObject = isDObj_t::value; \
typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \
typedef std::true_type has_classID_tag; \
static const CLID& ID() { \
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { \
static const CLID c(CID); return c; \
} \
static const char* typeNameString() { \
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
return #ARG1 "," #ARG2; \
} \
static const std::string& typeName() { \
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
static const std::string name = typeNameString(); \
return name; \
} \
......
......@@ -55,7 +55,6 @@ public:
*/
virtual const DataObjID& id() const = 0;
/**
* @brief Return the associated @c DataProxy, if any.
*/
......
......@@ -19,6 +19,7 @@
#include <unordered_map>
#include "DataModelRoot/RootType.h"
#include "CxxUtils/checker_macros.h"
// Forward declaration
......@@ -98,7 +99,7 @@ public:
bool has_type(const std::string& type_name) const;
std::string load_type(const std::string& type_name) const;
std::string load_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const;
/// list of reflex-types associated with a library name
std::vector<std::string> capabilities(const std::string& libname) const;
......@@ -134,7 +135,7 @@ public:
get_dups(DsoMap_t& dups, const DsoMap_t& db, bool pedantic) const;
/// load the reflex type after having loaded the hosting library
RootType rflx_type(const std::string& type_name) const;
RootType rflx_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const;
/// Default constructor:
DsoDb();
......
......@@ -2,11 +2,12 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHENAKERNEL_EXTENDEDEVNETCONTEXT_H
#define ATHENAKERNEL_EXTENDEDEVNETCONTEXT_H 1
#ifndef ATHENAKERNEL_EXTENDEDEVENTCONTEXT_H
#define ATHENAKERNEL_EXTENDEDEVENTCONTEXT_H
#include "AthenaKernel/IProxyDict.h"
#include "GaudiKernel/EventIDBase.h"
#include "CxxUtils/checker_macros.h"
namespace Atlas {
......@@ -20,7 +21,7 @@ namespace Atlas {
{}
void setProxy(IProxyDict* proxy) { m_proxy = proxy; }
IProxyDict* proxy() const { return m_proxy; }
IProxyDict* proxy ATLAS_NOT_CONST_THREAD_SAFE () const { return m_proxy; }
void setConditionsRun (EventIDBase::number_type conditionsRun)
{ m_conditionsRun = conditionsRun; }
......
......@@ -17,6 +17,7 @@
*
*****************************************************************************/
#include "CxxUtils/checker_macros.h"
#include "GaudiKernel/EventIDRange.h"
#include <set>
......@@ -56,7 +57,7 @@ public:
EventIDRange range() const { return m_range; }
void setRange( const EventIDRange& range) { m_range=range; }
T* objPtr() const { return m_objPtr; }
T* objPtr ATLAS_NOT_CONST_THREAD_SAFE () const { return m_objPtr; }
void setPtr( T* ptr ) { m_objPtr = ptr; }
friend std::ostream& operator<< (std::ostream& os, const IOVEntryT<T>& rhs) {
......
......@@ -55,7 +55,7 @@ public:
inline
const InterfaceID&
IProxyProviderSvc::interfaceID() {
static InterfaceID ID("IProxyProviderSvc", 0 , 0);
static const InterfaceID ID("IProxyProviderSvc", 0 , 0);
return ID;
}
......
......@@ -22,7 +22,7 @@
* }
@endcode
*
* This has several undesireable properties. First, it is overly verbose.
* This has several undesirable properties. First, it is overly verbose.
* 80% of the code in this example is devoted to error handling; if there
* are many of these, it becomes difficult to read what the code is
* actually doing.
......@@ -129,6 +129,7 @@
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/IMessageSvc.h"
#include <string>
#include <atomic>
class INamedInterface;
......@@ -285,10 +286,10 @@ private:
std::string::size_type m_pos;
/// If true, hide the source file and line number in output messages.
static bool s_hide_error_locus;
static std::atomic<bool> s_hide_error_locus;
/// If true, hide the function names in output messages.
static bool s_hide_function_names;
static std::atomic<bool> s_hide_function_names;
};
......
......@@ -276,7 +276,7 @@ DsoDb::has_type(const std::string& type_name) const
}
std::string
DsoDb::load_type(const std::string& type_name) const
DsoDb::load_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const
{
RootType t = this->rflx_type(type_name);
if (t.Id()) {
......@@ -634,7 +634,7 @@ DsoDb::get_dups(DsoMap_t& dups, const DsoMap_t& db, bool pedantic) const
/// load the reflex type after having loaded the hosting library
RootType
DsoDb::rflx_type(const std::string& type_name) const
DsoDb::rflx_type ATLAS_NOT_THREAD_SAFE (const std::string& type_name) const
{
const std::string rootmap_name = ::to_rootmap_name(type_name);
const std::string rflx_name = ::to_rflx_name(type_name);
......
......@@ -21,11 +21,11 @@ namespace errorcheck {
/// If true, hide the source file and line number in output messages.
bool ReportMessage::s_hide_error_locus = false;
std::atomic<bool> ReportMessage::s_hide_error_locus;
/// If true, hide the function names in output messages.
bool ReportMessage::s_hide_function_names = false;
std::atomic<bool> ReportMessage::s_hide_function_names;
/**
......
......@@ -14,6 +14,7 @@
#include "AthenaKernel/Chrono.h"
#include "CxxUtils/checker_macros.h"
#include "GaudiKernel/ChronoEntity.h"
#include <iostream>
#include <stdexcept>
......@@ -21,6 +22,9 @@
#include <cassert>
ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
int count = 0;
......
......@@ -4,7 +4,7 @@
// $Id$
/**
* @file IRCUOSVC_test.cxx
* @file IRCUSVC_test.cxx
* @author scott snyder <snyder@bnl.gov>
* @date Aug, 2016
* @brief Regression tests for RCUObject.
......
......@@ -14,6 +14,7 @@
#include "AthenaKernel/RCUObject.h"
#include "AthenaKernel/IRCUSvc.h"
#include "CxxUtils/checker_macros.h"
#include "boost/thread/shared_mutex.hpp"
#include "boost/thread/shared_lock_guard.hpp"
#include <cassert>
......@@ -94,15 +95,15 @@ struct Payload
int a, b, c, d;
static std::atomic<int> ninstance;
static bool dolog;
static std::atomic<bool> dolog;
private:
static std::vector<int> m_dlog;
static std::mutex m_mutex;
static std::vector<int> m_dlog ATLAS_THREAD_SAFE;
static std::mutex m_mutex ATLAS_THREAD_SAFE;
};
std::atomic<int> Payload::ninstance;
bool Payload::dolog = true;
std::atomic<bool> Payload::dolog (true);
std::vector<int> Payload::m_dlog;
std::mutex Payload::m_mutex;
......
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