[riot-notifications] [RIOT-OS/RIOT] core/mutex: Add mutex_cancel (#15442)

Marian Buschsieweke notifications at github.com
Fri Nov 13 21:00:20 CET 2020


### Contribution description

This commit adds the (pseudo)-module `mutex_cancel`, which unlocks the likewise named function. With this function, a thread blocked with `mutex_lock()` can be unblocked without it obtaining the mutex. A caller of `mutex_lock()` is notified via an `-ECANCELED` return code.

This is intended to simplify the implementation of `xtimer_mutex_lock_timeout()` and to implement `ztimer_mutex_lock_timeout()`.

### Testing procedure

With `tests/mutex_cancel` a test application is provided that must succeed.

### Issues/PRs references

Split out of https://github.com/RIOT-OS/RIOT/pull/15052
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15442

-- Commit Summary --

  * core/mutex: Add mutex_cancel()
  * tests: Add test for core_mutex_cancel

-- File Changes --

    M core/include/mutex.h (26)
    M core/mutex.c (44)
    A tests/mutex_cancel/Makefile (6)
    A tests/mutex_cancel/main.c (82)
    A tests/mutex_cancel/tests/01-run.py (20)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15442.patch
https://github.com/RIOT-OS/RIOT/pull/15442.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15442
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201113/346f6d78/attachment.htm>


More information about the notifications mailing list