Skip to content

Correct Timeout rescheduling #12941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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