mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
7b428916f5
commit
f766f7d421
|
@ -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) {
|
||||
|
|
|
@ -53,6 +53,7 @@ class Timer : private NonCopyable<Timer> {
|
|||
public:
|
||||
Timer();
|
||||
Timer(const ticker_data_t *data);
|
||||
~Timer();
|
||||
|
||||
/** Start the timer
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue