µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::rtos::interrupts::critical_section Class Reference

Interrupts critical section RAII helper. More...

#include <cmsis-plus/rtos/os.h>

Public Member Functions

Constructors & Destructor
 critical_section ()
 Enter an interrupts critical section.
 
 ~critical_section ()
 Exit the interrupts critical section.
 

Static Public Member Functions

Public Member Functions
static state_t enter (void)
 Enter an interrupts critical section.
 
static void exit (state_t state)
 Exit the interrupts critical section.
 

Detailed Description

Interrupts critical section RAII helper.

Use this class to define a critical section protected to interrupts service routines. The beginning of the critical section is exactly the place where this class is instantiated (the constructor will disable interrupts below the scheduler priority). The end of the critical section is the end of the surrounding block (the destructor will enable the interrupts).

Note
Can be nested as many times as required without problems, only the outer call will re-enable the interrupts.
Example
void
func(void)
{
// Do something
{
interrupts::critical_section ics; // Critical section begins here.
// Inside the critical section.
// No scheduler switches will happen here.
} // Critical section ends here.
// Do something else.
}
Interrupts critical section RAII helper.
Definition os-sched.h:498

Definition at line 497 of file os-sched.h.

Constructor & Destructor Documentation

◆ critical_section()

os::rtos::interrupts::critical_section::critical_section ( )
inline

Enter an interrupts critical section.

Parameters
None.
Note
Can be invoked from Interrupt Service Routines.

Definition at line 1118 of file os-sched.h.

◆ ~critical_section()

os::rtos::interrupts::critical_section::~critical_section ( )
inline

Exit the interrupts critical section.

Note
Can be invoked from Interrupt Service Routines.

Definition at line 1128 of file os-sched.h.

Member Function Documentation

◆ enter()

state_t os::rtos::interrupts::critical_section::enter ( void  )
inlinestatic

Enter an interrupts critical section.

Parameters
None.
Returns
The previous value of the interrupts priorities register.
Note
Can be invoked from Interrupt Service Routines.

Definition at line 1138 of file os-sched.h.

◆ exit()

void os::rtos::interrupts::critical_section::exit ( state_t  state)
inlinestatic

Exit the interrupts critical section.

Parameters
stateThe value to restore the interrupts priorities register.
Returns
Nothing.
Note
Can be invoked from Interrupt Service Routines.

Definition at line 1148 of file os-sched.h.


The documentation for this class was generated from the following file: