File indexing completed on 2024-04-06 12:11:55
0001 #ifndef FWCore_Concurrency_syncWait_h
0002 #define FWCore_Concurrency_syncWait_h
0003
0004
0005
0006
0007
0008 #include "FWCore/Concurrency/interface/WaitingTaskHolder.h"
0009 #include "FWCore/Concurrency/interface/FinalWaitingTask.h"
0010 #include "oneapi/tbb/task_group.h"
0011 #include <exception>
0012
0013 namespace edm {
0014 template <typename F>
0015 [[nodiscard]] std::exception_ptr syncWait(F&& iFunc) {
0016 std::exception_ptr exceptPtr{};
0017 oneapi::tbb::task_group group;
0018 FinalWaitingTask last{group};
0019 group.run([&]() { iFunc(WaitingTaskHolder(group, &last)); });
0020
0021 return last.waitNoThrow();
0022 }
0023 }
0024 #endif