[riot-commits] [RIOT-OS/RIOT] 9d4a92: core/hwtimer: disable interrupts in hwtimer_remove

Thomas Eichinger thomas.eichinger1 at gmail.com
Tue May 20 14:51:08 CEST 2014


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 9d4a92003c8e4ba37aa7ac6b62c1487461538f53
      https://github.com/RIOT-OS/RIOT/commit/9d4a92003c8e4ba37aa7ac6b62c1487461538f53
  Author: Ludwig Ortmann <ludwig.ortmann at fu-berlin.de>
  Date:   2014-05-16 (Fri, 16 May 2014)

  Changed paths:
    M core/hwtimer.c

  Log Message:
  -----------
  core/hwtimer: disable interrupts in hwtimer_remove

Before only the hardware timer's own interrupt was being disabled.
This led to a race condition in the following scenario:

```
Thread1:
    hwtimer_remove()
    hwtimer_arch_disable_interrupt();

// INTERRUPT -> Thread2 (which has a higher priority than Thread1) gets scheduled

Thread2:
    ...
    hwtimer_remove()
    hwtimer_arch_disable_interrupt(); // hwtimer interrupt is already disabled
    ...
    hwtimer_arch_enable_interrupt();
    ...
   // yield | terminate -> Thread1 gets scheduled again

Thread1:
    ... // these instructions are being run with the hwtimer interrupt enabled
    hwtimer_arch_enable_interrupt(); // hwtimer interrupt is already enabled
```

Fixes #924


  Commit: 5808662d0556ed11c891bdf25b6ad8eb4f247739
      https://github.com/RIOT-OS/RIOT/commit/5808662d0556ed11c891bdf25b6ad8eb4f247739
  Author: Thomas Eichinger <thomas.eichinger1 at gmail.com>
  Date:   2014-05-20 (Tue, 20 May 2014)

  Changed paths:
    M core/hwtimer.c

  Log Message:
  -----------
  Merge pull request #1193 from LudwigOrtmann/issue-924

core/hwtimer: disable interrupts in hwtimer_remove


Compare: https://github.com/RIOT-OS/RIOT/compare/1e12d5896bc0...5808662d0556


More information about the commits mailing list