GME  13
apr_reslist.h
Go to the documentation of this file.
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 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif /* __cplusplus */
00040 
00042 typedef struct apr_reslist_t apr_reslist_t;
00043 
00044 /* Generic constructor called by resource list when it needs to create a
00045  * resource.
00046  * @param resource opaque resource
00047  * @param param flags
00048  * @param pool  Pool
00049  */
00050 typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
00051                                                 apr_pool_t *pool);
00052 
00053 /* Generic destructor called by resource list when it needs to destroy a
00054  * resource.
00055  * @param resource opaque resource
00056  * @param param flags
00057  * @param pool  Pool
00058  */
00059 typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params,
00060                                                apr_pool_t *pool);
00061 
00062 /* Cleanup order modes */
00063 #define APR_RESLIST_CLEANUP_DEFAULT  0       
00064 #define APR_RESLIST_CLEANUP_FIRST    1       
00089 APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist,
00090                                              int min, int smax, int hmax,
00091                                              apr_interval_time_t ttl,
00092                                              apr_reslist_constructor con,
00093                                              apr_reslist_destructor de,
00094                                              void *params,
00095                                              apr_pool_t *pool);
00096 
00108 APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist);
00109 
00115 APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
00116                                               void **resource);
00117 
00121 APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
00122                                               void *resource);
00123 
00130 APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist,
00131                                           apr_interval_time_t timeout);
00132 
00137 APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);
00138 
00144 APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
00145                                                  void *resource);
00146 
00152 APU_DECLARE(apr_status_t) apr_reslist_maintain(apr_reslist_t *reslist);
00153 
00167 APU_DECLARE(void) apr_reslist_cleanup_order_set(apr_reslist_t *reslist,
00168                                                 apr_uint32_t mode);
00169 
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173 
00176 #endif  /* ! APR_RESLIST_H */