Skip to content

Commit ade17ba

Browse files
Irit ArkinIrit Arkin
authored andcommitted
Warnings - clarified with Mark K
1 parent b219870 commit ade17ba

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/reference/api/rtos/Mutex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
A Mutex is used to synchronize the execution of threads, for example to protect the access to a shared resource.
66

7-
<span class="warnings"> **Warning - ISR:** The `Mutex` methods cannot be called from interrupt service routines (ISR). In the current version of Mbed OS, if you attempt to use a mutex from within an ISR, nothing happens; attempts to lock a mutex succeed immediately, regardless of whether the lock is actually free. In other words, if you acquire a mutex lock in an ISR, you can break the thread safety mechanisms and introduce race-conditions into an otherwise safe piece of code. Future versions of Mbed OS will provide warnings and ultimately prevent this from happening. </span>
7+
<span class="notes"> **Note:** The `Mutex` methods cannot be called from interrupt service routines (ISR). In the current version of Mbed OS, if you attempt to use a mutex from within an ISR, nothing happens; attempts to lock a mutex succeed immediately, regardless of whether the lock is actually free. In other words, if you acquire a mutex lock in an ISR, you can break the thread safety mechanisms and introduce race-conditions into an otherwise safe piece of code. Future versions of Mbed OS will provide warnings and ultimately prevent this from happening. </span>
88

99
<span class="images">![](https://s3-us-west-2.amazonaws.com/mbed-os-docs-images/Mutex.png)</span>
1010

docs/reference/api/thread_safety.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The RTOS provides several mechanisms to move interrupt processing onto a thread.
7474
- [Queue](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/Queue_8h_source.html).
7575
- [Mail](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/Mail_8h_source.html).
7676

77-
<span class="warnings">**Warning:** In Mbed OS 5, if you attempt to use a mutex from within an interrupt, nothing happens; attempts to lock a mutex will succeed immediately, regardless of whether the lock is actually free. In other words, if you acquire a mutex lock in an interrupt, you can break the thread safety mechanisms and introduce race conditions into an otherwise safe piece of code. Future versions of Mbed OS will provide warnings and ultimately prevent this from happening.</span>
77+
<span class="notes">**Note:** In Mbed OS 5, if you attempt to use a mutex from within an interrupt, nothing happens; attempts to lock a mutex will succeed immediately, regardless of whether the lock is actually free. In other words, if you acquire a mutex lock in an interrupt, you can break the thread safety mechanisms and introduce race conditions into an otherwise safe piece of code. Future versions of Mbed OS will provide warnings and ultimately prevent this from happening.</span>
7878

7979
For more information see [rtos/Mutex.h](https://os-doc-builder.test.mbed.com/docs/development/mbed-os-api-doxy/Mutex_8h_source.html).
8080

@@ -88,7 +88,7 @@ For more information see[platform/critical.h](https://github.com/ARMmbed/mbed-os
8888

8989
Critical sections disable interrupts to provide uninterrupted access to a resource, so you can use critical sections to make code **interrupt safe**. However, you should avoid using critical sections if you can, because they must execute quickly, or they will cause system instability.
9090

91-
**Warnings**:
91+
**Notes**:
9292

9393
- Do not perform time consuming operations inside critical sections. This will negatively affect the timing of the entire system, because all interrupts are disabled during critical sections.
9494
- Do not invoke any standard lib or RTOS functions within a critical section; it could result in a hard fault because RTOS performs SVC calls.

0 commit comments

Comments
 (0)