Merge pull request #12941 from kjbracey-arm/chrono-timeout-fix

Correct Timeout rescheduling
pull/12945/head mbed-os-6.0.0-beta-1
Martin Kojtal 2020-05-07 21:32:37 +02:00 committed by GitHub
commit 1b2a68ae20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -27,11 +27,15 @@ namespace mbed {
void TimeoutBase::handler() void TimeoutBase::handler()
{ {
if (_function) { 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) { if (_lock_deepsleep) {
sleep_manager_unlock_deep_sleep(); sleep_manager_unlock_deep_sleep();
} }
_function(); function_to_call();
_function = nullptr;
} }
} }