Skip to content

Commit

Permalink
Merge pull request #12941 from kjbracey-arm/chrono-timeout-fix
Browse files Browse the repository at this point in the history
Correct Timeout rescheduling
  • Loading branch information
0xc0170 authored May 7, 2020
2 parents 7698b34 + 0a9e1db commit 1b2a68a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/source/Timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ namespace mbed {
void TimeoutBase::handler()
{
if (_function) {
Callback<void()> function_to_call = _function;
// Clean up state to "detached" before calling callback; it may attach
// a new callback. Equivalent to detach(), but skips the remove();
// it's unnecessary because we're in the ticker's handler.
_function = nullptr;
if (_lock_deepsleep) {
sleep_manager_unlock_deep_sleep();
}
_function();
_function = nullptr;
function_to_call();
}
}

Expand Down

0 comments on commit 1b2a68a

Please sign in to comment.