[riot-notifications] [RIOT-OS/RIOT] sys/xtimer: fix xtimer_mutex_lock_timeout corner cases (#6441)
notifications at github.com
Fri May 17 16:28:46 CEST 2019
cladmi commented on this pull request.
+ t.callback = _mutex_timeout;
+ t.arg = (void *)((mutex_thread_t *)&mt);
+ _xtimer_set64(&t, timeout, timeout >> 32);
+ /* a timeout lower than XTIMER_BACKOFF causes the xtimer to spin rather
+ * than to set a timer for interrupt. Hence, we shall make the mutex_lock
+ * call blocking only when the interrupt didn't occur yet. */
+ locked = _mutex_lock(mutex, (mt.timeout == NO_TIMEOUT));
While looking at the original code @julianHolzwarth we noticed the issue with this one, and looked for existing references. But actually this does not solve the concurrency completely.
Between the evaluation of `==` and the actual `irq_disable` in the function, the callback can be triggered.
He will provide a PR for the needed change in `core` to evaluate a `volatile` condition when the interrupt are disabled.
This would however maybe make using 'mt.timeout' not possible and may require another variable.
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...
More information about the notifications