|
NetBurner 3.5.7
PDF Version |
RAII wrapper for OS_CRIT that automatically enters and leaves a critical section. More...
#include <nbrtos.h>
Public Member Functions | |
| OSCriticalSectionObj (OS_CRIT &ocrit) | |
| Construct the object and enter the critical section, waiting indefinitely. | |
| OSCriticalSectionObj (OS_CRIT &ocrit, bool NoWait, TickTimeout &timeout) | |
| Construct the object and enter the critical section with configurable wait behavior. | |
| ~OSCriticalSectionObj () | |
| Destruct the object and call Leave() on the OS_CRIT to release the critical section. | |
RAII wrapper for OS_CRIT that automatically enters and leaves a critical section.
On construction, calls Enter() on the provided OS_CRIT object (waiting indefinitely by default). On destruction, calls Leave() to release the critical section. This guarantees the section is released regardless of how the enclosing scope is exited.
Expand for Example Usage
|
inline |
Construct the object and enter the critical section, waiting indefinitely.
| ocrit | Reference to the OS_CRIT object to enter. |
|
inline |
Construct the object and enter the critical section with configurable wait behavior.
| ocrit | Reference to the OS_CRIT object to enter. |
| NoWait | If true, attempts to enter without waiting (EnterNoWait()). If false, waits up to the specified timeout. |
| timeout | The TickTimeout duration to wait when NoWait is false. |