mirror of https://github.com/ARMmbed/mbed-os.git
Fix sleep lock underflow in LowPowerTimer
If a LowPowerTimer is started and then goes out of scope then a deep sleep lock underflow can occur. This is because the the variable '_lock_deepsleep' is checked when starting the timer but is not checked in the destructor, which unconditionally releases the deep sleep lock.pull/5242/head
parent
c60194fdfd
commit
32303a9130
|
@ -35,7 +35,9 @@ Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker
|
|||
Timer::~Timer() {
|
||||
core_util_critical_section_enter();
|
||||
if (_running) {
|
||||
sleep_manager_unlock_deep_sleep();
|
||||
if(_lock_deepsleep) {
|
||||
sleep_manager_unlock_deep_sleep();
|
||||
}
|
||||
}
|
||||
_running = 0;
|
||||
core_util_critical_section_exit();
|
||||
|
|
Loading…
Reference in New Issue