[riot-notifications] [RIOT-OS/RIOT] xtimer: hang on xtimer_spin_until (corner case) (#11149)

vac notifications at github.com
Sun Mar 10 17:31:51 CET 2019


I've been analyzing xtimer code and stoped on `xtimer_spin_until` function:

```c
static inline void xtimer_spin_until(uint32_t target)
{
#if XTIMER_MASK
    target = _xtimer_lltimer_mask(target);
#endif
    while (_xtimer_lltimer_now() > target) {}
    while (_xtimer_lltimer_now() < target) {}
}
```

`_xtimer_lltimer_now` will return uint32_t values within range: 0..UINT32_MAX. `xtimer_spin_until` will hang when the `target` value will be one of the following:
* 0,
* UINT32_MAX (4294967295U).

For target=0 it will hang on the first while loop.
For target=UINT32_MAX it will hang on the second while loop.

Please correct me if I'm wrong.

-- 
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/issues/11149
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190310/ad16c8b7/attachment.html>


More information about the notifications mailing list