| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

quickstart.cpp
Go to the documentation of this file.
1
16 #include <iostream>
17
18 #include <boost/threadpool.hpp>
19
20 using namespace std;
21 using namespace boost::threadpool;
22
23 // Some example tasks
24 void first_task() { cout << "first task is running\n"; }
25
26 void second_task() { cout << "second task is running\n"; }
27
28 int main( int argc, char* argv[] )
29 {
30 // Create fifo thread pool container with two threads.
31 pool tp( 2 );
32
33 // Add some tasks to the pool.
34 tp.schedule( &first_task );
35 tp.schedule( &second_task );
36
37 // Wait until all tasks are finished.
38 tp.wait();
39
40 // Now all tasks are finished!
41 return ( 0 );
42 }
boost::threadpool::thread_pool::wait
void wait(size_t task_threshold=0) const
The current thread of execution is blocked until the sum of all active and pending tasks is equal or ...
Definition: pool.hpp:176
first_task
void first_task()
Definition: quickstart.cpp:24
gaudirun.argv
list argv
Definition: gaudirun.py:235
main
int main(int argc, char *argv[])
Definition: quickstart.cpp:28
std
STL namespace.
boost::threadpool::thread_pool::schedule
bool schedule(task_type const &task)
Schedules a task for asynchronous execution.
Definition: pool.hpp:130
second_task
void second_task()
Definition: quickstart.cpp:26
pool
Definition: PoolClasses.h:11
compareRootHistos.tp
tuple tp
Definition: compareRootHistos.py:417
boost::threadpool
Definition: future.hpp:32
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:138
std::cout
threadpool.hpp
Main include.