Aldebaran documentation
|
C++ Libraries
|
index
libqi-api
2.1.4.13
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
qi
threadpool.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
* Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the COPYING file.
6
*/
7
8
9
#ifndef _QI_THREADPOOL_HPP_
10
#define _QI_THREADPOOL_HPP_
11
12
# include <boost/function.hpp>
13
# include <
qi/api.hpp
>
14
15
namespace
qi
16
{
17
class
ThreadPoolPrivate;
18
20
class
QI_API
ThreadPool
21
{
22
public
:
24
ThreadPool
(
unsigned
int
minWorkers = 2,
unsigned
int
maxWorkers = 100,
25
unsigned
int
minIdleWorkers = 1,
unsigned
int
maxIdleWorkers = 0);
27
~
ThreadPool
();
28
30
unsigned
int
size()
const
;
32
unsigned
int
active()
const
;
33
35
void
setMaxWorkers(
unsigned
int
n);
37
unsigned
int
getMaxWorkers()
const
;
39
void
setMinWorkers(
unsigned
int
n);
41
unsigned
int
getMinWorkers()
const
;
43
void
setMinIdleWorkers(
unsigned
int
n);
45
unsigned
int
getMinIdleWorkers()
const
;
47
void
setMaxIdleWorkers(
unsigned
int
n);
49
unsigned
int
getMaxIdleWorkers()
const
;
50
52
void
stop();
53
55
void
reset();
56
58
void
waitForAll
();
59
61
bool
schedule(
const
boost::function<
void
(
void
)>& f);
62
63
private
:
64
ThreadPoolPrivate* _p;
65
};
66
}
67
68
#endif // _QI_THREADPOOL_HPP_
api.hpp
dll import/export and compiler message
qi::ThreadPool
Pool of workers.
Definition:
threadpool.hpp:20
qi::waitForAll
void waitForAll(std::vector< Future< T > > &vect)
Helper function to wait on a vector of futures.
Definition:
future.hxx:238
QI_API
#define QI_API
Definition:
api.hpp:24
Copyright Aldebaran Robotics