| The Gaudi Framework v27r1

- 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()
25 {
26 cout << "first task is running\n" ;
27 }
28
29 void second_task()
30 {
31 cout << "second task is running\n" ;
32 }
33
34 int main(int argc,char *argv[])
35 {
36 // Create fifo thread pool container with two threads.
37 pool tp(2);
38
39 // Add some tasks to the pool.
40 tp.schedule(&first_task);
41 tp.schedule(&second_task);
42
43 // Wait until all tasks are finished.
44 tp.wait();
45
46 // Now all tasks are finished!
47 return(0);
48 }
49
50
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:227
main
int main(int argc, char *argv[])
Definition: quickstart.cpp:34
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:29
pool
Definition: PoolClasses.h:7
boost::threadpool
Definition: future.hpp:32
plotBacklogPyRoot.argc
tuple argc
Definition: plotBacklogPyRoot.py:128
std::cout
threadpool.hpp
Main include.