Unigine::ScopedMutexLock Class
Header: | #include <UnigineThread.h> |
Template class that implements the RAII (Resource Acquisition Is Initialization) pattern to manage mutex locking in a multithreaded environment. This class ensures that a mutex is automatically locked upon construction and unlocked when the object goes out of scope.
This class has the following aliases:
Alias | Description | Type |
---|---|---|
ScopedSpinLock ScopedLock |
Alias for ScopedMutexLock using MutexSpin class for spin-based scoped locking. Ensures the spinlock is acquired on construction and released on destruction. | MutexSpin |
ScopedReentrantSpinLock ScopedReentrantLock |
Alias for ScopedMutexLock using ReentrantMutexSpin enabling scoped locking of reentrant spinlocks. | ReentrantMutexSpin |
ScopedCriticalSectionLock | Alias for ScopedMutexLock using MutexCriticalSection. Provides scoped RAII-style locking using a Windows CRITICAL_SECTION. | MutexCriticalSection |
ScopedSlimLock | Alias for ScopedMutexLock using MutexSlim. Provides scoped RAII-style locking using a Windows SRW Lock. | MutexSlim |
ScopedReentrantSlimLock | Alias for ScopedMutexLock using ReentrantMutexSlim. Provides scoped RAII-style locking with support for reentrance using a Windows SRW Lock. | ReentrantMutexSlim |
ScopedSlimAdvanceLock | Alias for ScopedMutexLock using MutexSlimAdvance. Provides RAII-style scoped locking with the ability to check whether the lock is currently held using a Windows SRW Lock. | MutexSlimAdvance |
ScopedCriticalSectionAdvanceLock | Alias for ScopedMutexLock using MutexCriticalSectionAdvance. Provides RAII-style scoped locking with the ability to check whether the lock is currently held using a Windows CRITICAL_SECTION. | MutexCriticalSectionAdvance |
ScopedPThreadLock | Alias for ScopedMutexLock using MutexPThread. Provides scoped RAII-style locking via Linux pthread_mutex_t mutex. | MutexPThread |
ScopedReentrantPThreadLock | Alias for ScopedMutexLock using ReentrantMutexPThread. Provides scoped locking with reentrance via Linux pthread_mutex_t mutex. | ReentrantMutexPThread |
ScopedPThreadAdvanceLock | Alias for ScopedMutexLock using MutexPThreadAdvance. Provides scoped locking with internal state tracking via Linux pthread_mutex_t mutex. | MutexPThreadAdvance |
ScopedMutexLock Class
Members
ScopedMutexLock ( MutexType& m ) #
Constructor that locks the provided mutex. The lock remains held for the duration of the ScopedMutexLock object's lifetime.Arguments
- MutexType& m - A reference to a mutex object to be locked. The mutex must provide lock() and unlock() member functions.
~ScopedMutexLock ( ) #
Destructor that automatically unlocks the mutex when the ScopedMutexLock object goes out of scope.The information on this page is valid for UNIGINE 2.20 SDK.
Last update:
2025-07-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)