nn::os::CriticalSection Classclass CriticalSection : private ADLFireWall::NonCopyable
Class for handling critical sections. Critical sections are synchronization objects used for providing mutual exclusion.
This mechanism prevents certain areas within programs from being run simultaneously within multiple threads. It also prevents resources from being accessed by multiple threads simultaneously.
Critical sections play the same role as mutexes (nn::os::Mutex), but they have the following limitations.
nn::os::CriticalSection class performs considerably faster than nn::os::Mutex when there are no lock collisions between threads. In most cases, use nn::os::CriticalSection instead of nn::os::Mutex.
The use of nn::os::CriticalSection::ScopedLock makes it possible to enter a critical section when an object is created and stay in the critical section until the scope is exited.
nn::os::CriticalSection::ScopedLock
|
Enters a critical section when an object is created and stays in until the scope is exited. |
|---|
CriticalSection
|
Constructs an object. | |
|---|---|---|
Initialize
|
Initializes an object. | |
TryInitialize
|
Tries to initialize an object. | |
Finalize
|
Destroys a critical section. | |
~CriticalSection
|
Destructor. | |
Enter
|
Locks out other threads and prevents them from entering a critical section. This function blocks. | |
TryEnter
|
Locks out other threads and prevents them from entering a critical section. This function does not block. | |
Leave
|
Unlocks and allows other threads to enter a critical section. |
ADLFireWall::NonCopyable
nn::os::CriticalSection
CONFIDENTIAL