Apache Portable Runtime Utility Library
include/apr_thread_pool.h
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed
00004  * with this work for additional information regarding copyright
00005  * ownership.  The ASF licenses this file to you under the Apache
00006  * License, Version 2.0 (the "License"); you may not use this file
00007  * except in compliance with the License.  You may obtain a copy of
00008  * the License at
00009  *
00010  *     http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
00015  * implied.  See the License for the specific language governing
00016  * permissions and limitations under the License.
00017  */
00018 
00019 #ifndef APU_THREAD_POOL_H
00020 #define APU_THREAD_POOL_H
00021 
00022 #include "apu.h"
00023 #include "apr_thread_proc.h"
00024 
00045 #if APR_HAS_THREADS
00046 
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif /* __cplusplus */
00050 
00058 typedef struct apr_thread_pool apr_thread_pool_t;
00059 
00060 #define APR_THREAD_TASK_PRIORITY_LOWEST 0
00061 #define APR_THREAD_TASK_PRIORITY_LOW 63
00062 #define APR_THREAD_TASK_PRIORITY_NORMAL 127
00063 #define APR_THREAD_TASK_PRIORITY_HIGH 191
00064 #define APR_THREAD_TASK_PRIORITY_HIGHEST 255
00065 
00077 APU_DECLARE(apr_status_t) apr_thread_pool_create(apr_thread_pool_t **me,
00078                                                  apr_size_t init_threads,
00079                                                  apr_size_t max_threads,
00080                                                  apr_pool_t *pool);
00081 
00086 APU_DECLARE(apr_status_t) apr_thread_pool_destroy(apr_thread_pool_t *me);
00087 
00097 APU_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t *me,
00098                                                apr_thread_start_t func,
00099                                                void *param,
00100                                                apr_byte_t priority,
00101                                                void *owner);
00111 APU_DECLARE(apr_status_t) apr_thread_pool_schedule(apr_thread_pool_t *me,
00112                                                    apr_thread_start_t func,
00113                                                    void *param,
00114                                                    apr_interval_time_t time,
00115                                                    void *owner);
00116 
00126 APU_DECLARE(apr_status_t) apr_thread_pool_top(apr_thread_pool_t *me,
00127                                               apr_thread_start_t func,
00128                                               void *param,
00129                                               apr_byte_t priority,
00130                                               void *owner);
00131 
00141 APU_DECLARE(apr_status_t) apr_thread_pool_tasks_cancel(apr_thread_pool_t *me,
00142                                                        void *owner);
00143 
00149 APU_DECLARE(apr_size_t) apr_thread_pool_tasks_count(apr_thread_pool_t *me);
00150 
00156 APU_DECLARE(apr_size_t) apr_thread_pool_scheduled_tasks_count(apr_thread_pool_t *me);
00157 
00163 APU_DECLARE(apr_size_t) apr_thread_pool_threads_count(apr_thread_pool_t *me);
00164 
00170 APU_DECLARE(apr_size_t) apr_thread_pool_busy_count(apr_thread_pool_t *me);
00171 
00177 APU_DECLARE(apr_size_t) apr_thread_pool_idle_count(apr_thread_pool_t *me);
00178 
00186 APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_set(apr_thread_pool_t *me,
00187                                                      apr_size_t cnt);
00188 
00194 APU_DECLARE(apr_size_t)
00195     apr_thread_pool_tasks_run_count(apr_thread_pool_t * me);
00196 
00202 APU_DECLARE(apr_size_t)
00203     apr_thread_pool_tasks_high_count(apr_thread_pool_t * me);
00204 
00210 APU_DECLARE(apr_size_t)
00211     apr_thread_pool_threads_high_count(apr_thread_pool_t * me);
00212 
00218 APU_DECLARE(apr_size_t)
00219     apr_thread_pool_threads_idle_timeout_count(apr_thread_pool_t * me);
00220 
00226 APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_get(apr_thread_pool_t *me);
00227 
00234 APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_set(apr_thread_pool_t *me,
00235                                                        apr_size_t cnt);
00236 
00247 APU_DECLARE(apr_interval_time_t)
00248     apr_thread_pool_idle_wait_set(apr_thread_pool_t * me,
00249                                   apr_interval_time_t timeout);
00250 
00257 APU_DECLARE(apr_interval_time_t)
00258     apr_thread_pool_idle_wait_get(apr_thread_pool_t * me);
00259 
00265 APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_get(apr_thread_pool_t *me);
00266 
00273 APU_DECLARE(apr_size_t) apr_thread_pool_threshold_set(apr_thread_pool_t *me,
00274                                                       apr_size_t val);
00275 
00281 APU_DECLARE(apr_size_t) apr_thread_pool_threshold_get(apr_thread_pool_t * me);
00282 
00289 APU_DECLARE(apr_status_t) apr_thread_pool_task_owner_get(apr_thread_t *thd,
00290                                                          void **owner);
00291 
00294 #ifdef __cplusplus
00295 }
00296 #endif
00297 
00298 #endif /* APR_HAS_THREADS */
00299 #endif /* !APR_THREAD_POOL_H */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines