Class for creating a Mutex for a statically allocated critical section of data. More...
Public Member Functions | |
MutexStatic () noexcept | |
Set the flag that a critical section is initialized. | |
~MutexStatic () | |
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::Mutex | |
Mutex () noexcept | |
Initialize the data in the class. | |
~Mutex () | |
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 Mutex using Window 7 APIs. | |
Protected Attributes | |
uint_t | m_bValid |
Set to TRUE when constructed. | |
Protected Attributes inherited from Burger::Mutex | |
uint32_t | m_PlatformMutex [7] |
Platform specific CRITICAL_SECTION or mutex object. | |
Private Member Functions | |
MutexStatic (const MutexStatic &)=delete | |
MutexStatic & | operator= (const MutexStatic &)=delete |
MutexStatic (MutexStatic &&)=delete | |
MutexStatic & | operator= (MutexStatic &&)=delete |
Class for creating a Mutex 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.
|
privatedelete |
|
privatedelete |
|
noexcept |
Set the flag that a critical section is initialized.
Burger::MutexStatic::~MutexStatic | ( | ) |
Clears the flag that a critical section is initialized.
|
inlinenoexcept |
|
privatedelete |
|
privatedelete |
|
inlinenoexcept |
|
inlinenoexcept |