Apache Portable Runtime Utility Library
|
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more 00002 * contributor license agreements. See the NOTICE file distributed with 00003 * this work for additional information regarding copyright ownership. 00004 * The ASF licenses this file to You under the Apache License, Version 2.0 00005 * (the "License"); you may not use this file except in compliance with 00006 * the License. You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef APR_RESLIST_H 00018 #define APR_RESLIST_H 00019 00025 #include "apr.h" 00026 #include "apu.h" 00027 #include "apr_pools.h" 00028 #include "apr_errno.h" 00029 #include "apr_time.h" 00030 00031 #if APR_HAS_THREADS 00032 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif /* __cplusplus */ 00045 00047 typedef struct apr_reslist_t apr_reslist_t; 00048 00049 /* Generic constructor called by resource list when it needs to create a 00050 * resource. 00051 * @param resource opaque resource 00052 * @param param flags 00053 * @param pool Pool 00054 */ 00055 typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params, 00056 apr_pool_t *pool); 00057 00058 /* Generic destructor called by resource list when it needs to destroy a 00059 * resource. 00060 * @param resource opaque resource 00061 * @param param flags 00062 * @param pool Pool 00063 */ 00064 typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params, 00065 apr_pool_t *pool); 00066 00096 APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist, 00097 int min, int smax, int hmax, 00098 apr_interval_time_t ttl, 00099 apr_reslist_constructor con, 00100 apr_reslist_destructor de, 00101 void *params, 00102 apr_pool_t *pool); 00103 00115 APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist); 00116 00122 APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist, 00123 void **resource); 00124 00128 APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist, 00129 void *resource); 00130 00137 APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist, 00138 apr_interval_time_t timeout); 00139 00144 APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist); 00145 00151 APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist, 00152 void *resource); 00153 00154 00155 #ifdef __cplusplus 00156 } 00157 #endif 00158 00161 #endif /* APR_HAS_THREADS */ 00162 00163 #endif /* ! APR_RESLIST_H */