1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15593 from maribu/mutex_cancel_doc

core/mutex: fix documentation
This commit is contained in:
benpicco 2020-12-09 00:47:33 +01:00 committed by GitHub
commit 3f9e8c8ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,7 +298,7 @@ void mutex_unlock_and_sleep(mutex_t *mutex);
* Canonical use:
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
* static void timeout_cb(void *_arg) {
* static void timeout_cb(void *arg) {
* mutex_cancel(arg);
* }
*
@ -306,15 +306,13 @@ void mutex_unlock_and_sleep(mutex_t *mutex);
* uint32_t timeout)
* {
* mutex_cancel_t mc = mutex_cancel_init(mutex);
* ztimer_t t;
* t.callback = timeout_cb;
* t.arg = &mc;
* ztimer_t t = { .callback = timeout_cb, .arg = &mc };
* ztimer_set(clock, &t, timeout);
* if (0 == mutex_lock_cancelable(mutex)) {
* ztimer_remove(clock, &t);
* return 0;
* if (mutex_lock_cancelable(&mc)) {
* return -ECANCELED;
* }
* return -ECANCELED;
* ztimer_remove(clock, &t);
* return 0;
* }
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*