ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
SG::LockedAllocator Class Reference

A pointer type that holds a lock on an allocator object. More...

#include <LockedAllocator.h>

Collaboration diagram for SG::LockedAllocator:

Public Member Functions

 LockedAllocator (ArenaAllocatorBase *alloc, std::mutex &mutex)
 Constructor. More...
 
ArenaAllocatorBaseoperator* ()
 Dereference the pointer. More...
 
ArenaAllocatorBaseoperator-> ()
 Dereference the pointer. More...
 
ArenaAllocatorBaseget ()
 Return the underlying pointer. More...
 
const ArenaAllocatorBaseget () const
 Return the underlying pointer. More...
 

Private Attributes

ArenaAllocatorBasem_alloc
 The allocator to which we point. More...
 
std::unique_lock< std::mutex > m_lock
 The lock for the allocator. More...
 

Detailed Description

A pointer type that holds a lock on an allocator object.

A SG::LockedAllocator object functions as a pointer to a SG::ArenaAllocatorBase object. It also holds a lock associated with that object; the lock is released when the SG::LockedAllocator is destroyed.

These objects may be moved, but not copied.

Definition at line 39 of file LockedAllocator.h.

Constructor & Destructor Documentation

◆ LockedAllocator()

SG::LockedAllocator::LockedAllocator ( ArenaAllocatorBase alloc,
std::mutex &  mutex 
)

Constructor.

Parameters
allocThe allocator object to which we're pointing.
mutexThe mutex to lock.

Member Function Documentation

◆ get() [1/2]

ArenaAllocatorBase* SG::LockedAllocator::get ( )

Return the underlying pointer.

◆ get() [2/2]

const ArenaAllocatorBase* SG::LockedAllocator::get ( ) const

Return the underlying pointer.

◆ operator*()

ArenaAllocatorBase& SG::LockedAllocator::operator* ( )

Dereference the pointer.

◆ operator->()

ArenaAllocatorBase* SG::LockedAllocator::operator-> ( )

Dereference the pointer.

Member Data Documentation

◆ m_alloc

ArenaAllocatorBase* SG::LockedAllocator::m_alloc
private

The allocator to which we point.

Definition at line 76 of file LockedAllocator.h.

◆ m_lock

std::unique_lock<std::mutex> SG::LockedAllocator::m_lock
private

The lock for the allocator.

Definition at line 79 of file LockedAllocator.h.


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