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

Marian Buschsieweke notifications at github.com
Mon Nov 16 11:18:48 CET 2020

> but, what happens when the lock gets canceled anyways? (locker uses "mutex_lock()", but someone calls "mutex_cancel()" on it?

`mutex_lock()` must never fail :-)

Btw: I think I will place a preconditions that `mutex_lock_may_fail()` is called with IRQs disabled. This would get rid of all the complexity, as one could simply do:

   unsigned state = irq_disable();
   if (mutex_lock_may_fail(&mut, state) == 0) {

Here there is no chance that the ISR hits right before the call to `mutex_lock_may_fail()`, and all those abuse `wait_data` to signal cancellation is no longer needed. So not even a pseudo-module would be required to enable it, as the linker would be totally capable to garbage collect every single byte of RAM and ROM needed by this.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201116/b4e2b5ee/attachment-0001.htm>

More information about the notifications mailing list