File indexing completed on 2024-04-06 12:11:55
0001 #ifndef FWCore_Concurrency_FunctorTask_h
0002 #define FWCore_Concurrency_FunctorTask_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <atomic>
0023 #include <exception>
0024 #include <memory>
0025
0026
0027 #include "FWCore/Concurrency/interface/TaskBase.h"
0028
0029
0030
0031 namespace edm {
0032 template <typename F>
0033 class FunctorTask : public TaskBase {
0034 public:
0035 explicit FunctorTask(F f) : func_(std::move(f)) {}
0036
0037 void execute() final { func_(); };
0038
0039 private:
0040 F func_;
0041 };
0042
0043 template <typename F>
0044 FunctorTask<F>* make_functor_task(F f) {
0045 return new FunctorTask<F>(std::move(f));
0046 }
0047 }
0048
0049 #endif