Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion FWCore/Concurrency/interface/WaitingTaskHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace edm {
/** Use in the case where you need to inform the parent task of a
failure before some other child task which may be run later reports
a different, but related failure. You must later call doneWaiting
in the same thread passing the same exceptoin.
in the same thread passing the same exception.
*/
void presetTaskAsFailed(std::exception_ptr iExcept) {
if (iExcept) {
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Concurrency/interface/WaitingTaskWithArenaHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ namespace edm {
// the task. doneWaiting can be called from a non-TBB thread.
void doneWaiting(std::exception_ptr iExcept);

// Use in the case where you need to inform the parent task of a
// failure before some other child task which may be run later
// reports a different, but related failure. You must later call
// doneWaiting in the same thread passing the same exception.
void presetTaskAsFailed(std::exception_ptr iExcept) noexcept;

// This next function is useful if you know from the context that
// m_arena (which is set when the constructor was executes) is the
// same arena in which you want to execute the doneWaiting function.
Expand Down
5 changes: 4 additions & 1 deletion FWCore/Concurrency/interface/WaitingThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ namespace edm {
convertException::wrap([&func]() { func(); });
} catch (cms::Exception& e) {
e.addContext(errorContext());
holder.doneWaiting(std::current_exception());
// doneWaiting() is intentionally not called here. The
// reference count decrement must be done only in
// threadLoop() (see the comment there)
holder.presetTaskAsFailed(std::current_exception());
}
};
thisPtr_ = std::move(thisPtr);
Expand Down
6 changes: 6 additions & 0 deletions FWCore/Concurrency/src/WaitingTaskWithArenaHolder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ namespace edm {
}
}

void WaitingTaskWithArenaHolder::presetTaskAsFailed(std::exception_ptr iExcept) noexcept {
if (iExcept) {
m_task->dependentTaskFailed(iExcept);
}
}

// This next function is useful if you know from the context that
// m_arena (which is set when the constructor was executes) is the
// same arena in which you want to execute the doneWaiting function.
Expand Down