Release deep sleep lock in destructor of Timer class

Release the deep sleep lock when running instances of the Timer class
are deleted. This ensures that deep sleep locks are properly released
by the Timer class.
pull/5095/head
Russ Butler 2017-09-13 20:05:40 -05:00
parent 7b428916f5
commit f766f7d421
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,15 @@ Timer::Timer(const ticker_data_t *data) : _running(), _start(), _time(), _ticker
reset();
}
Timer::~Timer() {
core_util_critical_section_enter();
if (_running) {
sleep_manager_unlock_deep_sleep();
}
_running = 0;
core_util_critical_section_exit();
}
void Timer::start() {
core_util_critical_section_enter();
if (!_running) {

View File

@ -53,6 +53,7 @@ class Timer : private NonCopyable<Timer> {
public:
Timer();
Timer(const ticker_data_t *data);
~Timer();
/** Start the timer
*/