Skip to content

Commit ae78858

Browse files
author
Amanda Butler
authored
Merge pull request #370 from deepikabhavnani/critical_lock
CriticalSection Class Update (MERGE version - mbed-os-5.8)
2 parents 34272dc + a61b6ff commit ae78858

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/reference/api/platform/CriticalSectionLock.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
## CriticalSectionLock
22

3-
The CriticalSectionLock class provides a mechanism to access a resource without interruption. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the destructor restores the state of interrupts upon exit. Nesting of critical section is supported, and the destructor enables interrupts only when you exit from the last nested critical section.
3+
The CriticalSectionLock class provides a mechanism to access a resource without interruption. With the `CriticalSectionLock::enable` API, you can enter critical section with interrupts disabled. The `CriticalSectionLock::disable()` API is the exit from critical section, and the last exit call restores the state of interrupts.
44

55
CriticalSectionLock class is based on RAII approach. In other words, the constructor acquires the lock, and the destructor destroys it automatically when it is out of scope. We do not recommend you use CriticalSectionLock as global or a member of a class because you will enter critical section on object creation, and all interrupts will be disabled.
66

7+
Mbed OS supports nesting of critical section, and the destructor enables interrupts only when you exit from the last nested critical section.
8+
79
<span class="notes">**Note:** You must not use time-consuming operations, standard library and RTOS functions inside critical section.</span>
810

911
### CriticalSectionLock class reference

0 commit comments

Comments
 (0)