Skip to content

Commit 3e78b7d

Browse files
author
Amanda Butler
authored
Add a tip to Thread.md
Add a debugging tips section.
1 parent 9080c48 commit 3e78b7d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/api/rtos/Thread.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ The Callback API provides a convenient way to pass arguments to spawned threads.
8989

9090
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/rtos_threading_with_callback/)](https://os.mbed.com/teams/mbed_example/code/rtos_threading_with_callback/file/5938bdb7b0bb/main.cpp)
9191

92+
## Debugging tips
93+
94+
When debugging Thread, check the full RTX state (ready, blocked and so on) for a deadlock (two things waiting for each other) or a missed signal leading to an event machine stall. You can confirm a deadlock if you see two threads in the "blocked" state waiting for a resource that the other is supposed to signal.
95+
96+
To reduce deadlocks, proactively code in a safe way by maintaining a mental ordering of your mutexes and never claiming a high-level mutex while holding a low-level one.
97+
9298
## Related content
9399

94100
- [Application flow control tutorial](../tutorials/application-flow-control.html).

0 commit comments

Comments
 (0)