Welcome to mirror list, hosted at ThFree Co, Russian Federation.

class_std_thread_pool.qbk « generated « doc « attic - github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7c940b97d10d12020ccdc61fd7a83c27c5d720e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
[/============================================================================
  Boost.AFIO

  Use, modification and distribution is subject to 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)
=============================================================================/]


[/ Generated by doxygen_xml2qbk 1.1.1, don't change, will be overwritten automatically]
[/ Generated from doxy/doxygen_output/xml\classboost_1_1afio_1_1std__thread__pool.xml]
[section:std_thread_pool std_thread_pool]
'''<?dbhtml-include href="disqus_identifiers/std_thread_pool.html"?>'''

'''<indexterm><primary>std_thread_pool</primary></indexterm>'''
A very simple thread pool based on std::thread or boost::thread. 

[heading Description]
This instantiates a [^`asio::io_service`] and a latchable [^`asio::io_service::work`] to keep any threads working until the instance is destructed. 

[heading Synopsis]
``class std_thread_pool
      : public thread_source
{
  // ...
};
``

[heading Constructor(s)]
[table
[[Function] [Description] [Parameters] ]
[[``std_thread_pool(size_t no)``

] [Constructs a thread pool of ['no] workers. ] [[* size_t]: ['no]:  The number of worker threads to create 



]]
[[``~std_thread_pool()``

] [] [

]]
]

[heading Member Function(s)]
[table
[[Function] [Description] [Parameters]  [Returns]]
[[``asio::io_service & io_service()``

] [Returns the underlying io_service. ] [

][

]
]
[[``template<class R>
void enqueue(enqueued_task< R > task)``

] [Sends a task to the thread pool for execution. ] [[* enqueued_task< R >]: ['task]:  



][

]
]
[[``template<class F>
shared_future< typename std::result_of< F()>::type > enqueue(F f)``

] [Sends some callable entity to the thread pool for execution. ] [[* F]: ['f]:  Any instance of a callable type 



][
An enqueued task for the enqueued callable

]
]
[[``void add_workers(size_t no)``

] [Adds more workers to the thread pool. ] [[* size_t]: ['no]:  The number of worker threads to add 



][

]
]
[[``void destroy()``

] [Destroys the thread pool, waiting for worker threads to exit beforehand. ] [

][

]
]
]

[heading Header]
`#include <boost/afio/v2/afio.hpp>`

'''<?dbhtml-include href="disqus_comments.html"?>'''
[endsect]