Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
CriticalSectionLock Class Reference
[CriticalSectionLock functions]
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. | |
Static Public Member Functions | |
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 CriticalSectionLock.h.
Member Function Documentation
static void disable | ( | ) | [static] |
Mark the end of a critical section.
Definition at line 103 of file CriticalSectionLock.h.
static void enable | ( | ) | [static] |
Mark the start of a critical section.
Definition at line 96 of file 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 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 CriticalSectionLock.h.
Generated on Tue Jul 12 2022 14:27:15 by
