Warning, file /DD4hep/DDDigi/test_task_queue.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <tbb/tbb.h>
0014 #include <iostream>
0015
0016 class say_hello {
0017 int cnt = 0;
0018 const char* message;
0019 public:
0020
0021 say_hello(const char* str, int i) : message(str), cnt(i) { }
0022 void operator( ) ( ) const {
0023 cout << message << " " << cnt << endl;
0024 }
0025 };
0026
0027 int main() {
0028 tbb::task_scheduler_init init(2);
0029 tbb::task_group tg1, tg2, tg3;
0030 for(int i=0; i<200; ++i) {
0031 tg1.run(std::move(say_hello("child(1)",i)));
0032 tg2.run(std::move(say_hello("child(2)",i)));
0033 tg3.run(std::move(say_hello("child(3)",i)));
0034 }
0035 tg1.wait( );
0036 tg2.wait( );
0037 tg3.wait( );
0038 }