mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

CriticalSectionLock Class Reference

RAII object for disabling, then restoring, interrupt state Usage: More...

#include <CriticalSectionLock.h>

Public Member Functions

 MBED_DEPRECATED_SINCE ("mbed-os-5.8","This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::enable.") void lock()
 Mark the start of a critical section.
 MBED_DEPRECATED_SINCE ("mbed-os-5.8","This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::disable.") void unlock()
 Mark the end of a critical section.
 MBED_DEPRECATED_SINCE ("mbed-os-5.8","This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::enable.") void lock()
 Mark the start of a critical section.
 MBED_DEPRECATED_SINCE ("mbed-os-5.8","This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::disable.") void unlock()
 Mark the end of a critical section.

Static Public Member Functions

static void enable ()
 Mark the start of a critical section.
static void disable ()
 Mark the end of a critical section.
static void enable ()
 Mark the start of a critical section.
static void disable ()
 Mark the end of a critical section.

Detailed Description

RAII object for disabling, then restoring, interrupt state Usage:

 // RAII style usage
 unsigned int atomic_counter_increment(unsigned int &counter) {
     CriticalSectionLock lock;
     // Code in this block will run with interrupts disabled
     // Interrupts will be restored to their previous state automatically
     // at the end of function scope
     return ++counter;
 }

 // free locking usage
 unsigned int atomic_counter_decrement(unsigned int &counter) {
     CriticalSectionLock::enable();
     // Code in this block will run with interrupts disabled
     counter--;
     CriticalSectionLock::disable(); // need explicitly to disable critical section lock
     // interrupts will be restored to their previous state here
     return counter;
 }

Definition at line 58 of file cmsis/BUILD/mbed/platform/CriticalSectionLock.h.


Member Function Documentation

static void disable (  ) [static]

Mark the end of a critical section.

Definition at line 103 of file cmsis/BUILD/mbed/platform/CriticalSectionLock.h.

static void disable (  ) [static]

Mark the end of a critical section.

Definition at line 103 of file platform/CriticalSectionLock.h.

static void enable (  ) [static]

Mark the start of a critical section.

Definition at line 96 of file cmsis/BUILD/mbed/platform/CriticalSectionLock.h.

static void enable (  ) [static]

Mark the start of a critical section.

Definition at line 96 of file platform/CriticalSectionLock.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.8"  ,
"This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::enable."   
)

Mark the start of a critical section.

Replaced by static function CriticalSectionLock::enable.

Definition at line 74 of file platform/CriticalSectionLock.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.8"  ,
"This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::disable."   
)

Mark the end of a critical section.

Replaced by static function CriticalSectionLock::enable.

Definition at line 86 of file cmsis/BUILD/mbed/platform/CriticalSectionLock.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.8"  ,
"This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::disable."   
)

Mark the end of a critical section.

Replaced by static function CriticalSectionLock::enable.

Definition at line 86 of file platform/CriticalSectionLock.h.

MBED_DEPRECATED_SINCE ( "mbed-os-5.8"  ,
"This function is inconsistent with RAII and is being removed in the future.""Replaced by static function CriticalSectionLock::enable."   
)

Mark the start of a critical section.

Replaced by static function CriticalSectionLock::enable.

Definition at line 74 of file cmsis/BUILD/mbed/platform/CriticalSectionLock.h.