Skip to content

Commit 8bead55

Browse files
author
deepikabhavnani
committed
Added RAII approach and scope description
1 parent 807375e commit 8bead55

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/reference/api/platform/CriticalSectionLock.md

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

3-
CriticalSectionLock class provides a mechanism to access a resource uniterrupted. With the `lock` API, you can enter critical section with interrupts disabled. The `unlock` API is the exit from critical section, and the state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.
3+
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 state of interrupts is restored upon exit. Nesting of critical section is supported, and interrupts are enabled only when we exit from last nested critical section.
4+
5+
CriticalSectionLock class is based on RAII approach i.e. lock is acquired in constructor and destroyed automatically when out of scope as part of destructor. Usage of CriticalSectionLock as global or member of class is not recommended, as you will enter critical section on object creation and all interrupts will be disabled.
6+
47

58
<span class="notes">**Note:** You must not use time consuming operations, standard library and RTOS functions inside critical section.</span>
69

0 commit comments

Comments
 (0)