ATLAS Offline Software
Loading...
Searching...
No Matches
DsoRootLock.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
10
11
12#include "CxxUtils/AthDsoCbk.h"
14#include "TVirtualRWMutex.h"
15
16
36{
37public:
42
43
47 static int hook (const ath_dso_event* event, void* userdata);
48};
49
50
58
59
63int DsoRootLock::hook (const ath_dso_event* event, void* /*userdata*/)
64{
65 // Skip for Xrd libraries --- otherwise we can deadlock.
66 if (event->fname && strncmp (event->fname, "libXrd", 6) == 0) return 0;
67
68 // If the core mutex has been created, acquire it before loading
69 // a library and release it on completion.
70 // Hope these are always properly nested!
71 ROOT::TVirtualRWMutex* m ATLAS_THREAD_SAFE = ROOT::gCoreMutex;
72 if (m) {
73 if (event->step == 0) {
74 m->WriteLock();
75 }
76 else if (event->step == 1)
77 {
78 m->WriteUnLock(nullptr);
79 }
80 }
81 return 0;
82}
83
84
int ath_dso_cbk_register(ath_dso_event_cbk_t cbk, void *userdata)
const DsoRootLock dsoRootLock
Set up this hook when this library gets loaded.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Workaround for ROOT TClassTable locking problem.
DsoRootLock()
Constructor.
static int hook(const ath_dso_event *event, void *userdata)
Acquire the ROOT core lock during library loading.
-*- C -*- AthDsoCbk.h Header file for the dso callbacks api Author: S.Binetbinet@cern....
Definition AthDsoCbk.h:22