|
||||
File indexing completed on 2025-01-18 09:14:10
0001 //========================================================================== 0002 // AIDA Detector description implementation 0003 //-------------------------------------------------------------------------- 0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0005 // All rights reserved. 0006 // 0007 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0009 // 0010 // Author : M.Frank 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( ); // wait for tasks to complete 0036 tg2.wait( ); // wait for tasks to complete 0037 tg3.wait( ); // wait for tasks to complete 0038 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |