Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::RecursiveMutexStatic Class Reference

Class for creating a RecursiveMutex for a statically allocated critical section of data. More...

Inheritance diagram for Burger::RecursiveMutexStatic:
Collaboration diagram for Burger::RecursiveMutexStatic:

Public Member Functions

 RecursiveMutexStatic () noexcept
 Set the flag that a critical section is initialized.
 ~RecursiveMutexStatic ()
 Clears the flag that a critical section is initialized.
void lock (void) noexcept
 Locks a mutex if initialized.
uint_t try_lock (void) noexcept
 Tries to lock a mutex if initialized.
void unlock (void) noexcept
 Unlocks a mutex if initialized.
Public Member Functions inherited from Burger::RecursiveMutex
 RecursiveMutex () noexcept
 Initialize the data in the class.
 ~RecursiveMutex ()
 Shutdown the data in the class.
void lock (void) noexcept
 Locks the mutex.
uint_t try_lock (void) noexcept
 Attempt to lock the mutex.
void unlock (void) noexcept
 Unlocks the mutex.
void * get_platform_mutex (void) noexcept
 Access the platform mutex data.
uint32_t get_threadID (void) const noexcept
 Access the owner thread ID for the SRWLock.
uint32_t get_count (void) const noexcept
 Get the lock count for a SRWLock.
void set_state (uint32_t uCount, uint32_t uThreadID) noexcept
 Set the SRWLock state.
uint_t is_using_SRWlock (void) const noexcept
 Is the RecursiveMutex using Window 7 APIs.

Protected Attributes

uint_t m_bValid
 Set to TRUE when constructed.
Protected Attributes inherited from Burger::RecursiveMutex
uint32_t m_PlatformMutex [7]
 Platform specific CRITICAL_SECTION or mutex object.

Private Member Functions

 RecursiveMutexStatic (const RecursiveMutexStatic &)=delete
RecursiveMutexStaticoperator= (const RecursiveMutexStatic &)=delete
 RecursiveMutexStatic (RecursiveMutexStatic &&)=delete
RecursiveMutexStaticoperator= (RecursiveMutexStatic &&)=delete

Detailed Description

Class for creating a RecursiveMutex for a statically allocated critical section of data.


When an object is created in static memory, the order of startup and shutdown is indeterminate in a cross platform way. To avoid an accidental call to this class before it's constructed or after it's destructed, this class will test a flag to determine if it's out of sequence and if so, the lock() and unlock() functions will perform no action. Since C++'s startup and shutdown sequence is performed on a single thread, this is a safe method to ensure that unknown startup/shutdown sequences won't accidentally thread lock.

See also
RecursiveMutex

Constructor & Destructor Documentation

◆ RecursiveMutexStatic() [1/3]

Burger::RecursiveMutexStatic::RecursiveMutexStatic ( const RecursiveMutexStatic & )
privatedelete

◆ RecursiveMutexStatic() [2/3]

Burger::RecursiveMutexStatic::RecursiveMutexStatic ( RecursiveMutexStatic && )
privatedelete

◆ RecursiveMutexStatic() [3/3]

Burger::RecursiveMutexStatic::RecursiveMutexStatic ( )
noexcept

Set the flag that a critical section is initialized.


◆ ~RecursiveMutexStatic()

Burger::RecursiveMutexStatic::~RecursiveMutexStatic ( )

Clears the flag that a critical section is initialized.


Member Function Documentation

◆ lock()

void BURGER_API Burger::RecursiveMutexStatic::lock ( void )
noexcept

Locks a mutex if initialized.


See also
RecursiveMutexStatic::lock() and unlock()

◆ operator=() [1/2]

RecursiveMutexStatic & Burger::RecursiveMutexStatic::operator= ( const RecursiveMutexStatic & )
privatedelete

◆ operator=() [2/2]

RecursiveMutexStatic & Burger::RecursiveMutexStatic::operator= ( RecursiveMutexStatic && )
privatedelete

◆ try_lock()

uint_t BURGER_API Burger::RecursiveMutexStatic::try_lock ( void )
noexcept

Tries to lock a mutex if initialized.


See also
RecursiveMutexStatic::try_lock() and lock()

◆ unlock()

void BURGER_API Burger::RecursiveMutexStatic::unlock ( void )
noexcept

Unlocks a mutex if initialized.


See also
RecursiveMutexStatic::unlock() and lock()

Member Data Documentation

◆ m_bValid

uint_t Burger::RecursiveMutexStatic::m_bValid
protected

Set to TRUE when constructed.