Skip to content

Commit 94389ea

Browse files
author
Amanda Butler
authored
Merge pull request #1166 from ARMmbed/AnotherButler-patch-2
Update Thread.md
2 parents de347c5 + 2a9e32c commit 94389ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/api/rtos/Thread.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ All the internal thread data structures are part of the C++ class, but by defaul
1212

1313
The default stack size is 4K. However, the application can override it by using the configuration system and setting the `THREAD_STACK_SIZE` option to the required size in `mbed_app.json`. For details, please see the [configuration documentation](../../reference/configuration/configuration.md).
1414

15+
<span class="notes">**Note:** The main thread stack size is specified as `rtos.main-thread-stack-size` in the configuration .json file. That defines the main thread for `mbed_rtos_start` in `mbed_rtos_rtx.c`.</span>
16+
1517
## Thread class reference
1618

1719
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/classrtos_1_1_thread.html)
@@ -87,6 +89,12 @@ The Callback API provides a convenient way to pass arguments to spawned threads.
8789

8890
[![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)
8991

92+
## Debugging tips
93+
94+
When debugging threads, 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 each waiting for a resource that the other is supposed to signal.
95+
96+
To reduce deadlocks, proactively code in a safe way by never claiming a high-level mutex while holding a low-level one.
97+
9098
## Related content
9199

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

0 commit comments

Comments
 (0)