Apache Portable Runtime Utility Library
apr_thread_pool.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed
4  * with this work for additional information regarding copyright
5  * ownership. The ASF licenses this file to you under the Apache
6  * License, Version 2.0 (the "License"); you may not use this file
7  * except in compliance with the License. You may obtain a copy of
8  * the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  * implied. See the License for the specific language governing
16  * permissions and limitations under the License.
17  */
18 
19 #ifndef APU_THREAD_POOL_H
20 #define APU_THREAD_POOL_H
21 
22 #include "apu.h"
23 #include "apr_thread_proc.h"
24 
45 #if APR_HAS_THREADS
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif /* __cplusplus */
50 
58 typedef struct apr_thread_pool apr_thread_pool_t;
59 
60 #define APR_THREAD_TASK_PRIORITY_LOWEST 0
61 #define APR_THREAD_TASK_PRIORITY_LOW 63
62 #define APR_THREAD_TASK_PRIORITY_NORMAL 127
63 #define APR_THREAD_TASK_PRIORITY_HIGH 191
64 #define APR_THREAD_TASK_PRIORITY_HIGHEST 255
65 
77 APU_DECLARE(apr_status_t) apr_thread_pool_create(apr_thread_pool_t **me,
78  apr_size_t init_threads,
79  apr_size_t max_threads,
80  apr_pool_t *pool);
81 
86 APU_DECLARE(apr_status_t) apr_thread_pool_destroy(apr_thread_pool_t *me);
87 
97 APU_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t *me,
98  apr_thread_start_t func,
99  void *param,
100  apr_byte_t priority,
101  void *owner);
111 APU_DECLARE(apr_status_t) apr_thread_pool_schedule(apr_thread_pool_t *me,
112  apr_thread_start_t func,
113  void *param,
114  apr_interval_time_t time,
115  void *owner);
116 
126 APU_DECLARE(apr_status_t) apr_thread_pool_top(apr_thread_pool_t *me,
127  apr_thread_start_t func,
128  void *param,
129  apr_byte_t priority,
130  void *owner);
131 
141 APU_DECLARE(apr_status_t) apr_thread_pool_tasks_cancel(apr_thread_pool_t *me,
142  void *owner);
143 
149 APU_DECLARE(apr_size_t) apr_thread_pool_tasks_count(apr_thread_pool_t *me);
150 
156 APU_DECLARE(apr_size_t) apr_thread_pool_scheduled_tasks_count(apr_thread_pool_t *me);
157 
163 APU_DECLARE(apr_size_t) apr_thread_pool_threads_count(apr_thread_pool_t *me);
164 
170 APU_DECLARE(apr_size_t) apr_thread_pool_busy_count(apr_thread_pool_t *me);
171 
177 APU_DECLARE(apr_size_t) apr_thread_pool_idle_count(apr_thread_pool_t *me);
178 
186 APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_set(apr_thread_pool_t *me,
187  apr_size_t cnt);
188 
194 APU_DECLARE(apr_size_t)
196 
202 APU_DECLARE(apr_size_t)
204 
210 APU_DECLARE(apr_size_t)
212 
218 APU_DECLARE(apr_size_t)
220 
226 APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_get(apr_thread_pool_t *me);
227 
234 APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_set(apr_thread_pool_t *me,
235  apr_size_t cnt);
236 
247 APU_DECLARE(apr_interval_time_t)
249  apr_interval_time_t timeout);
250 
257 APU_DECLARE(apr_interval_time_t)
259 
265 APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_get(apr_thread_pool_t *me);
266 
273 APU_DECLARE(apr_size_t) apr_thread_pool_threshold_set(apr_thread_pool_t *me,
274  apr_size_t val);
275 
281 APU_DECLARE(apr_size_t) apr_thread_pool_threshold_get(apr_thread_pool_t * me);
282 
289 APU_DECLARE(apr_status_t) apr_thread_pool_task_owner_get(apr_thread_t *thd,
290  void **owner);
291 
294 #ifdef __cplusplus
295 }
296 #endif
297 
298 #endif /* APR_HAS_THREADS */
299 #endif /* !APR_THREAD_POOL_H */
apr_size_t apr_thread_pool_idle_max_get(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_task_owner_get(apr_thread_t *thd, void **owner)
struct apr_thread_pool apr_thread_pool_t
Definition: apr_thread_pool.h:58
apr_status_t apr_thread_pool_push(apr_thread_pool_t *me, apr_thread_start_t func, void *param, apr_byte_t priority, void *owner)
apr_size_t apr_thread_pool_threads_high_count(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_top(apr_thread_pool_t *me, apr_thread_start_t func, void *param, apr_byte_t priority, void *owner)
apr_size_t apr_thread_pool_threshold_set(apr_thread_pool_t *me, apr_size_t val)
apr_size_t apr_thread_pool_tasks_run_count(apr_thread_pool_t *me)
apr_size_t apr_thread_pool_tasks_count(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_destroy(apr_thread_pool_t *me)
apr_size_t apr_thread_pool_idle_count(apr_thread_pool_t *me)
apr_size_t apr_thread_pool_scheduled_tasks_count(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_tasks_cancel(apr_thread_pool_t *me, void *owner)
apr_size_t apr_thread_pool_threshold_get(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_schedule(apr_thread_pool_t *me, apr_thread_start_t func, void *param, apr_interval_time_t time, void *owner)
apr_size_t apr_thread_pool_threads_count(apr_thread_pool_t *me)
apr_interval_time_t apr_thread_pool_idle_wait_set(apr_thread_pool_t *me, apr_interval_time_t timeout)
apr_size_t apr_thread_pool_thread_max_set(apr_thread_pool_t *me, apr_size_t cnt)
apr_size_t apr_thread_pool_idle_max_set(apr_thread_pool_t *me, apr_size_t cnt)
apr_size_t apr_thread_pool_threads_idle_timeout_count(apr_thread_pool_t *me)
apr_size_t apr_thread_pool_thread_max_get(apr_thread_pool_t *me)
apr_status_t apr_thread_pool_create(apr_thread_pool_t **me, apr_size_t init_threads, apr_size_t max_threads, apr_pool_t *pool)
apr_size_t apr_thread_pool_tasks_high_count(apr_thread_pool_t *me)
apr_interval_time_t apr_thread_pool_idle_wait_get(apr_thread_pool_t *me)
apr_size_t apr_thread_pool_busy_count(apr_thread_pool_t *me)