Skip to content

Commit c9a5157

Browse files
author
Amanda Butler
authored
Update warning in Wait.md
Update warning to match code.
1 parent c75222f commit c9a5157

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/api/platform/Wait.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
# Wait
22

3-
<span class="warnings">**Warning:** This API has been deprecated. In its place, please use [explicit sleep functions](../apis/power-management-sleep.html).</span>
3+
<span class="warnings">**Warning:** `wait` is deprecated in favor of explicit sleep functions. To sleep, replace `wait` with `ThisThread::sleep_for` (C++) or `thread_sleep_for` (C). To wait (without sleeping), call `wait_us`. `wait_us` is safe to call from ISR context.</span>
4+
5+
Wait functions provide simple wait capabilities. The OS scheduler puts the current thread in `waiting state`, allowing another thread to execute. Even better: If there are no other threads in `ready state`, it can put the whole microcontroller to `sleep`, saving energy.
6+
7+
## Avoiding OS delay
8+
9+
When you call wait, your board's CPU will sleep in the RTOS for the whole number of milliseconds and then spin as necessary to make up the remaining fraction of a millisecond. However, it blocks the platform deep sleep for the entire duration.
10+
11+
## Wait function reference
12+
13+
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/mbed__wait__api_8h_source.html)
14+
15+
## Example
16+
17+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/wait_ex_1/)](https://os.mbed.com/teams/mbed_example/code/wait_ex_1/file/4f0543415053/main.cpp)
18+
19+
## Related content
20+
21+
- [RTOS](rtos.html) overview.
22+
- [Application flow control tutorial](../tutorials/application-flow-control.html).

0 commit comments

Comments
 (0)