1 #ifndef ARTDAQ_CORE_UTILITIES_TRACELOCK
2 #define ARTDAQ_CORE_UTILITIES_TRACELOCK_HH 1
10 template<
typename MUTEX = std::mutex>
20 TraceLock(MUTEX& mutex,
int level, std::string
const& description)
22 , description_(description)
25 TLOG_ARB(level_,
"TraceLock") <<
"Acquired Lock " << description_ <<
", mutex=" << (
void*)&mutex <<
", lock=" << (
void*)&lock_;
33 TLOG_ARB(level_,
"TraceLock") <<
"Releasing lock " << description_ <<
", lock=" << (
void*)&lock_;
42 std::unique_lock<MUTEX> lock_;
43 std::string description_;
The TraceLock class allows a user to debug the acquisition and releasing of locks, by wrapping the unique_lock<std::mutex> API with TRACE calls.
virtual ~TraceLock()
Release the TraceLock.
TraceLock(MUTEX &mutex, int level, std::string const &description)
Construct a TraceLock.