feat(misc): add asynchronous call function cancellation function (#3439)

* feat(misc): add asynchronous call function cancellation function

* Update documentation

* Remove useless comments

* remove continue

Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech
2022-07-03 18:31:17 +08:00
committed by GitHub
parent 7ada1301c2
commit d43f10a180
3 changed files with 35 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ It can be misleading if you use an operating system and call `lv_timer_handler`
In some cases, you can't perform an action immediately. For example, you can't delete an object because something else is still using it, or you don't want to block the execution now.
For these cases, `lv_async_call(my_function, data_p)` can be used to call `my_function` on the next invocation of `lv_timer_handler`. `data_p` will be passed to the function when it's called.
Note that only the data pointer is saved, so you need to ensure that the variable will be "alive" while the function is called. It can be *static*, global or dynamically allocated data.
If you want to cancel an asynchronous call, call `lv_async_call_cancel(my_function, data_p)`, which will clear all asynchronous calls matching `my_function` and `data_p`.
For example:
```c