µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
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. More...
 
 ~critical_section ()
 Exit the interrupts critical section. More...
 

Static Public Member Functions

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

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.
}

Definition at line 498 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 1103 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 1116 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 1128 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 1140 of file os-sched.h.


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