Skip to content

Commit 9f0acf1

Browse files
author
Amanda Butler
authored
Add examples to Kernel.md
Add examples, as in PR #792
1 parent 2ea7aa9 commit 9f0acf1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/api/rtos/Kernel.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
## Kernel interface functions
22

3-
The Kernel namespace implements functions to read RTOS information. Currently it implements one function to read the current RTOS kernel millisecond tick count.
3+
The Kernel namespace implements interfaces to attach a function to some kernel events and also to read the kernel tick count.
44

55
### Kernel namespace reference
66

77
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/v5.10/mbed-os-api-doxy/namespacertos_1_1_kernel.html)
88

99
### `get_ms_count()` example
1010

11-
Kernel implements one function named `get_ms_count()` to read the current RTOS kernel millisecond tick count. The below code snippet demonstrates use of the `get_ms_count()` function to calculate the elapsed time:
11+
You can use the function `get_ms_count()` to read the current RTOS kernel millisecond tick count. The below code snippet demonstrates use of the `get_ms_count()` function to calculate the elapsed time:
1212

1313
```
1414
void send_data()
@@ -24,3 +24,15 @@ void send_data()
2424
uint64_t elapsed_ms = later - now;
2525
}
2626
```
27+
28+
### `attach_idle_hook()` example
29+
30+
The function `attach_idle_hook()` can be used to attach a function to be called by the RTOS idle task. The below code snippet demostrates the usage.
31+
32+
[![View Example](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-example-kernel-hooks)](https://github.com/ARMmbed/mbed-os-example-kernel-hooks/blob/master/main.cpp)
33+
34+
### `attach_thread_terminate_hook()` example
35+
36+
The function `attach_thread_terminate_hook()` can be used to attach a function to be called when a thread terminates.
37+
38+
[![View Example](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-example-kernel-hooks)](https://github.com/ARMmbed/mbed-os-example-kernel-hooks/blob/master/main.cpp)

0 commit comments

Comments
 (0)