Fix a concurrency problem in the multithreaded executor (#703)
Both, the `Executor::execute_any_executable` and the destructor for the `AnyExecutable` object used by the multithreaded executor, reset the `can_be_taken_from_` flag on a MutuallyExclusive group. This cause the variable to get out of sync and threads to process executables out of sequence. This fix clears the callback group variable of the `AnyExecutable` instance effectively preventing its destructor from modifying the variable at the wrong time. Issue: #702 Signed-off-by: Guillaume Autran <gautran@clearpath.ai>
This commit is contained in:
parent
ddf4d345b3
commit
97ed34a042
1 changed files with 3 additions and 0 deletions
|
@ -101,5 +101,8 @@ MultiThreadedExecutor::run(size_t)
|
|||
scheduled_timers_.erase(it);
|
||||
}
|
||||
}
|
||||
// Clear the callback_group to prevent the AnyExecutable destructor from
|
||||
// resetting the callback group `can_be_taken_from`
|
||||
any_exec.callback_group.reset();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue