Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_workers.h
Go to the documentation of this file.
1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
2 
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __mod_h2__h2_workers__
18 #define __mod_h2__h2_workers__
19 
20 /* Thread pool specific to executing h2_tasks. Has a minimum and maximum
21  * number of workers it creates. Starts with minimum workers and adds
22  * some on load, reduces the number again when idle.
23  *
24  */
25 struct apr_thread_mutex_t;
26 struct apr_thread_cond_t;
27 struct h2_mplx;
28 struct h2_request;
29 struct h2_task;
30 
31 typedef struct h2_workers h2_workers;
32 
33 struct h2_workers {
36 
43 
46 
47  unsigned int aborted : 1;
48 
50 
51  APR_RING_HEAD(h2_worker_list, h2_worker) workers;
52  APR_RING_HEAD(h2_worker_zombies, h2_worker) zombies;
53  APR_RING_HEAD(h2_mplx_list, h2_mplx) mplxs;
55 
58 
60 };
61 
62 
63 /* Create a worker pool with the given minimum and maximum number of
64  * threads.
65  */
67  int min_size, int max_size,
69 
70 /* Destroy the worker pool and all its threads.
71  */
72 void h2_workers_destroy(h2_workers *workers);
73 
80 
85 
91 void h2_workers_set_max_idle_secs(h2_workers *workers, int idle_secs);
92 
111 
118 void h2_workers_tx_free(h2_workers *workers, apr_size_t count);
119 
120 #endif /* defined(__mod_h2__h2_workers__) */
size_t apr_size_t
Definition: apr.h:375
int idle_workers
Definition: h2_workers.h:41
Definition: h2_task.h:52
Definition: h2_mplx.h:62
Definition: apr_arch_thread_mutex.h:28
server_rec * s
Definition: h2_workers.h:34
apr_status_t h2_workers_register(h2_workers *workers, struct h2_mplx *m)
apr_size_t h2_workers_tx_reserve(h2_workers *workers, apr_size_t count)
int max_idle_secs
Definition: h2_workers.h:42
Definition: h2.h:118
apr_size_t max_tx_handles
Definition: h2_workers.h:44
apr_size_t spare_tx_handles
Definition: h2_workers.h:45
int worker_count
Definition: h2_workers.h:40
apr_pool_t * pool
Definition: h2_workers.h:35
struct apr_thread_cond_t * mplx_added
Definition: h2_workers.h:57
apr_status_t h2_workers_unregister(h2_workers *workers, struct h2_mplx *m)
int mplx_count
Definition: h2_workers.h:54
struct apr_thread_mutex_t * lock
Definition: h2_workers.h:56
A structure to store information for each virtual server.
Definition: httpd.h:1302
struct apr_thread_mutex_t * tx_lock
Definition: h2_workers.h:59
int next_worker_id
Definition: h2_workers.h:37
int min_workers
Definition: h2_workers.h:38
h2_workers * h2_workers_create(server_rec *s, apr_pool_t *pool, int min_size, int max_size, apr_size_t max_tx_handles)
Definition: h2_worker.h:40
apr_threadattr_t * thread_attr
Definition: h2_workers.h:49
int max_workers
Definition: h2_workers.h:39
APR_RING_HEAD(h2_worker_list, h2_worker) workers
unsigned int aborted
Definition: h2_workers.h:47
Definition: apr_arch_threadproc.h:50
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
void h2_workers_destroy(h2_workers *workers)
void h2_workers_set_max_idle_secs(h2_workers *workers, int idle_secs)
int apr_status_t
Definition: apr_errno.h:44
Definition: apr_arch_thread_cond.h:34
Definition: h2_workers.h:33
void h2_workers_tx_free(h2_workers *workers, apr_size_t count)