Fix a merge_op timing hole

This commit is contained in:
Jesse Lee 2020-07-27 13:37:09 -04:00
parent 79225e044a
commit fcb603db45
1 changed files with 7 additions and 2 deletions

View File

@ -296,7 +296,13 @@ Status TaskGroup::CreateAsyncTask(const std::string &my_name, const std::functio
return Status::OK();
}
void TaskGroup::interrupt_all() noexcept { intrp_svc_->InterruptAll(); }
void TaskGroup::interrupt_all() noexcept {
// There is a racing condition if we don't stop the interrupt service at this point. New resource
// may come in and not being picked up after we call InterruptAll(). So stop new comers and then
// interrupt any existing resources.
(void)intrp_svc_->ServiceStop();
intrp_svc_->InterruptAll();
}
Status TaskGroup::join_all(Task::WaitFlag wf) {
Status rc;
@ -312,7 +318,6 @@ Status TaskGroup::join_all(Task::WaitFlag wf) {
}
Status TaskGroup::DoServiceStop() {
intrp_svc_->ServiceStop();
interrupt_all();
return (join_all(Task::WaitFlag::kNonBlocking));
}