quickstart.cpp File Reference

Quick start example. More...

#include <iostream>
#include <boost/threadpool.hpp>
Include dependency graph for quickstart.cpp:

Go to the source code of this file.

Functions

void first_task ()
 
void second_task ()
 
int main (int argc, char *argv[])
 

Detailed Description

Quick start example.

This is a very simple example which can be used to configure the threadpool environment on your system.

Copyright (c) 2005-2006 Philipp Henkel

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

http://threadpool.sourceforge.net

Definition in file quickstart.cpp.

Function Documentation

void first_task ( )

Definition at line 24 of file quickstart.cpp.

25 {
26  cout << "first task is running\n" ;
27 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 34 of file quickstart.cpp.

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 }
void first_task()
Definition: quickstart.cpp:24
void second_task()
Definition: quickstart.cpp:29
void second_task ( )

Definition at line 29 of file quickstart.cpp.

30 {
31  cout << "second task is running\n" ;
32 }