We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7698b34 + 0a9e1db commit 1b2a68aCopy full SHA for 1b2a68a
drivers/source/Timeout.cpp
@@ -27,11 +27,15 @@ namespace mbed {
27
void TimeoutBase::handler()
28
{
29
if (_function) {
30
+ Callback<void()> function_to_call = _function;
31
+ // Clean up state to "detached" before calling callback; it may attach
32
+ // a new callback. Equivalent to detach(), but skips the remove();
33
+ // it's unnecessary because we're in the ticker's handler.
34
+ _function = nullptr;
35
if (_lock_deepsleep) {
36
sleep_manager_unlock_deep_sleep();
37
}
- _function();
- _function = nullptr;
38
+ function_to_call();
39
40
41
0 commit comments