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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
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 56 of file CriticalSectionLock.h.
Member Function Documentation
void disable | ( | ) | [static] |
Mark the end of a critical section.
Definition at line 48 of file CriticalSectionLock.cpp.
void enable | ( | ) | [static] |
Mark the start of a critical section.
Definition at line 43 of file CriticalSectionLock.cpp.
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.
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.
Generated on Tue Jul 12 2022 13:55:44 by
