diff --git a/docs/reference/api/platform/CriticalSectionLock.md b/docs/reference/api/platform/CriticalSectionLock.md index f6fe23b87d..5b27c3a4c0 100644 --- a/docs/reference/api/platform/CriticalSectionLock.md +++ b/docs/reference/api/platform/CriticalSectionLock.md @@ -1,9 +1,11 @@ ## CriticalSectionLock -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. +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. 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. +Mbed OS supports nesting of critical section, and the destructor enables interrupts only when you exit from the last nested critical section. + **Note:** You must not use time-consuming operations, standard library and RTOS functions inside critical section. ### CriticalSectionLock class reference