Cbeam
Loading...
Searching...
No Matches
cbeam::container::thread_safe_container< T >::lock_guard Class Reference

Inner class providing RAII-style locking mechanism. More...

#include <thread_safe_container.hpp>

Public Member Functions

 lock_guard (std::recursive_mutex &mutex)
 Constructs the lock guard and locks the provided mutex.
 
 ~lock_guard () noexcept
 Destructor that unlocks the mutex.
 
 lock_guard (const lock_guard &)=delete
 
lock_guardoperator= (const lock_guard &)=delete
 

Detailed Description

template<typename T>
class cbeam::container::thread_safe_container< T >::lock_guard

Inner class providing RAII-style locking mechanism.

This class implements a lock guard for thread-safe operations, utilizing a recursive mutex. It locks the mutex upon construction and unlocks it upon destruction, ensuring exception safety and preventing deadlocks in a scoped block.

Constructor & Destructor Documentation

◆ lock_guard() [1/2]

template<typename T>
cbeam::container::thread_safe_container< T >::lock_guard::lock_guard ( std::recursive_mutex & mutex)
inlineexplicit

Constructs the lock guard and locks the provided mutex.

Parameters
mutexThe mutex to be locked.

◆ ~lock_guard()

template<typename T>
cbeam::container::thread_safe_container< T >::lock_guard::~lock_guard ( )
inlinenoexcept

Destructor that unlocks the mutex.

◆ lock_guard() [2/2]

template<typename T>
cbeam::container::thread_safe_container< T >::lock_guard::lock_guard ( const lock_guard & )
delete

Member Function Documentation

◆ operator=()

template<typename T>
lock_guard & cbeam::container::thread_safe_container< T >::lock_guard::operator= ( const lock_guard & )
delete

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