From 01e1c07a011f26bef11820f276808d0f7080c428 Mon Sep 17 00:00:00 2001 From: Martin Kojtal <0xc0170@gmail.com> Date: Thu, 28 Sep 2017 12:18:11 +0100 Subject: [PATCH] Ticker: add dtor implementation Dtor should invoke detach --- drivers/Ticker.cpp | 4 ++++ drivers/Ticker.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/Ticker.cpp b/drivers/Ticker.cpp index c2589c0d808..1e26ff791be 100644 --- a/drivers/Ticker.cpp +++ b/drivers/Ticker.cpp @@ -22,6 +22,10 @@ namespace mbed { +void Ticker::~Ticker() { + detach(); +} + void Ticker::detach() { core_util_critical_section_enter(); remove(); diff --git a/drivers/Ticker.h b/drivers/Ticker.h index cc5e5dd9e04..af39306924b 100644 --- a/drivers/Ticker.h +++ b/drivers/Ticker.h @@ -76,6 +76,7 @@ class Ticker : public TimerEvent, private NonCopyable { #endif } + ~Ticker(); /** Attach a function to be called by the Ticker, specifying the interval in seconds * * @param func pointer to the function to be called