Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
src
cpp
server
dynamic_thread_pool.h
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 2015 gRPC authors.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
#ifndef GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
20
#define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
21
22
#include <functional>
23
#include <list>
24
#include <queue>
25
26
#include "
src/core/lib/gprpp/sync.h
"
27
#include "
src/core/lib/gprpp/thd.h
"
28
#include "
src/cpp/server/thread_pool_interface.h
"
29
30
namespace
grpc
{
31
32
class
DynamicThreadPool
final :
public
ThreadPoolInterface
{
33
public
:
34
explicit
DynamicThreadPool
(
int
reserve_threads);
35
~DynamicThreadPool
()
override
;
36
37
void
Add
(
const
std::function
<
void
()>&
callback
)
override
;
38
39
private
:
40
class
DynamicThread
{
41
public
:
42
explicit
DynamicThread
(
DynamicThreadPool
*
pool
);
43
~DynamicThread
();
44
45
private
:
46
DynamicThreadPool
*
pool_
;
47
grpc_core::Thread
thd_
;
48
void
ThreadFunc
();
49
};
50
grpc_core::Mutex
mu_
;
51
grpc_core::CondVar
cv_
;
52
grpc_core::CondVar
shutdown_cv_
;
53
bool
shutdown_
;
54
std::queue
<
std::function
<void()>>
callbacks_
;
55
int
reserve_threads_
;
56
int
nthreads_
;
57
int
threads_waiting_
;
58
std::list<DynamicThread*>
dead_threads_
;
59
60
void
ThreadFunc
();
61
static
void
ReapThreads
(std::list<DynamicThread*>* tlist);
62
};
63
64
}
// namespace grpc
65
66
#endif // GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
grpc::DynamicThreadPool::DynamicThread::DynamicThread
DynamicThread(DynamicThreadPool *pool)
Definition:
dynamic_thread_pool.cc:25
grpc::DynamicThreadPool::callbacks_
std::queue< std::function< void()> > callbacks_
Definition:
dynamic_thread_pool.h:54
grpc_core::CondVar
Definition:
src/core/lib/gprpp/sync.h:126
grpc::DynamicThreadPool::Add
void Add(const std::function< void()> &callback) override
Definition:
dynamic_thread_pool.cc:104
grpc::DynamicThreadPool::~DynamicThreadPool
~DynamicThreadPool() override
Definition:
dynamic_thread_pool.cc:94
grpc
Definition:
grpcpp/alarm.h:33
grpc::DynamicThreadPool::threads_waiting_
int threads_waiting_
Definition:
dynamic_thread_pool.h:57
grpc::ThreadPoolInterface
Definition:
thread_pool_interface.h:27
grpc::DynamicThreadPool::dead_threads_
std::list< DynamicThread * > dead_threads_
Definition:
dynamic_thread_pool.h:58
grpc::DynamicThreadPool::cv_
grpc_core::CondVar cv_
Definition:
dynamic_thread_pool.h:51
grpc::DynamicThreadPool::reserve_threads_
int reserve_threads_
Definition:
dynamic_thread_pool.h:55
grpc::DynamicThreadPool::DynamicThread::thd_
grpc_core::Thread thd_
Definition:
dynamic_thread_pool.h:47
thread_pool_interface.h
grpc::DynamicThreadPool::DynamicThread::ThreadFunc
void ThreadFunc()
Definition:
dynamic_thread_pool.cc:37
grpc::DynamicThreadPool
Definition:
dynamic_thread_pool.h:32
grpc::DynamicThreadPool::shutdown_
bool shutdown_
Definition:
dynamic_thread_pool.h:53
grpc::DynamicThreadPool::ReapThreads
static void ReapThreads(std::list< DynamicThread * > *tlist)
Definition:
dynamic_thread_pool.cc:88
callback
static void callback(void *arg, int status, int timeouts, struct hostent *host)
Definition:
acountry.c:224
grpc::DynamicThreadPool::DynamicThread::~DynamicThread
~DynamicThread()
Definition:
dynamic_thread_pool.cc:35
queue
struct queue queue
grpc_core::Mutex
Definition:
src/core/lib/gprpp/sync.h:61
thd.h
grpc::DynamicThreadPool::ThreadFunc
void ThreadFunc()
Definition:
dynamic_thread_pool.cc:50
grpc_core::Thread
Definition:
thd.h:43
grpc::DynamicThreadPool::nthreads_
int nthreads_
Definition:
dynamic_thread_pool.h:56
pool
InternalDescriptorPool * pool
Definition:
bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:807
grpc::DynamicThreadPool::DynamicThreadPool
DynamicThreadPool(int reserve_threads)
Definition:
dynamic_thread_pool.cc:76
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition:
grpc_tool.cc:250
grpc::DynamicThreadPool::shutdown_cv_
grpc_core::CondVar shutdown_cv_
Definition:
dynamic_thread_pool.h:52
grpc::DynamicThreadPool::mu_
grpc_core::Mutex mu_
Definition:
dynamic_thread_pool.h:50
sync.h
grpc::DynamicThreadPool::DynamicThread::pool_
DynamicThreadPool * pool_
Definition:
dynamic_thread_pool.h:46
grpc::DynamicThreadPool::DynamicThread
Definition:
dynamic_thread_pool.h:40
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:14