ATLAS Offline Software
Loading...
Searching...
No Matches
oh_scoped_lock_histogram Class Reference

Scoped lock to be used for threaded histogram operations. More...

#include <OHLockedHist.h>

Inheritance diagram for oh_scoped_lock_histogram:
Collaboration diagram for oh_scoped_lock_histogram:

Public Member Functions

 oh_scoped_lock_histogram ()
 Lock.
 ~oh_scoped_lock_histogram ()
 Unlock.

Static Public Member Functions

static void set_histogram_mutex (std::mutex &mutex)
 Set mutex to be used in oh_lock_histogram.
static void reset_histogram_mutex ()
 Reset (disable) histogram mutex.

Static Protected Attributes

static std::mutex *m_mutex ATLAS_THREAD_SAFE

Private Member Functions

void * operator new (size_t)
 Do not allow dynamic allocation to avoid accidental deadlocks.

Detailed Description

Scoped lock to be used for threaded histogram operations.

This is the scoped version of oh_lock_histogram in case you need to protect several histogram operations.

Example:

{
myhistogram->Fill(...);
myhistogram->LabelsDeflate();
}

Definition at line 108 of file OHLockedHist.h.

Constructor & Destructor Documentation

◆ oh_scoped_lock_histogram()

oh_scoped_lock_histogram::oh_scoped_lock_histogram ( )
inline

Lock.

Definition at line 111 of file OHLockedHist.h.

112 {
113 if (m_mutex) m_mutex->lock();
114 }

◆ ~oh_scoped_lock_histogram()

oh_scoped_lock_histogram::~oh_scoped_lock_histogram ( )
inline

Unlock.

Definition at line 117 of file OHLockedHist.h.

118 {
119 if (m_mutex) m_mutex->unlock();
120 }

Member Function Documentation

◆ operator new()

void * oh_scoped_lock_histogram::operator new ( size_t )
private

Do not allow dynamic allocation to avoid accidental deadlocks.

◆ reset_histogram_mutex()

void oh_lock_histogram_mutex::reset_histogram_mutex ( )
inlinestaticinherited

Reset (disable) histogram mutex.

Definition at line 39 of file OHLockedHist.h.

39{ m_mutex = nullptr; }

◆ set_histogram_mutex()

void oh_lock_histogram_mutex::set_histogram_mutex ( std::mutex & mutex)
inlinestaticinherited

Set mutex to be used in oh_lock_histogram.

Definition at line 36 of file OHLockedHist.h.

36{ m_mutex = &mutex; }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::mutex* m_mutex oh_lock_histogram_mutex::ATLAS_THREAD_SAFE
staticprotectedinherited

Definition at line 46 of file OHLockedHist.h.


The documentation for this class was generated from the following file: