GME  13
apr_proc_mutex.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_PROC_MUTEX_H
00018 #define APR_PROC_MUTEX_H
00019 
00025 #include "apr.h"
00026 #include "apr_pools.h"
00027 #include "apr_errno.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif /* __cplusplus */
00032 
00044 typedef enum {
00045     APR_LOCK_FCNTL,         
00046     APR_LOCK_FLOCK,         
00047     APR_LOCK_SYSVSEM,       
00048     APR_LOCK_PROC_PTHREAD,  
00049     APR_LOCK_POSIXSEM,      
00050     APR_LOCK_DEFAULT        
00051 } apr_lockmech_e;
00052 
00054 typedef struct apr_proc_mutex_t apr_proc_mutex_t;
00055 
00056 /*   Function definitions */
00057 
00079 APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
00080                                                 const char *fname,
00081                                                 apr_lockmech_e mech,
00082                                                 apr_pool_t *pool);
00083 
00095 APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
00096                                                     const char *fname,
00097                                                     apr_pool_t *pool);
00098 
00104 APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex);
00105 
00113 APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex);
00114 
00119 APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex);
00120 
00125 APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex);
00126 
00133 APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex);
00134 
00140 APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex);
00141 
00147 APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex);
00148 
00152 APR_DECLARE(const char *) apr_proc_mutex_defname(void);
00153 
00158 APR_POOL_DECLARE_ACCESSOR(proc_mutex);
00159 
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165 
00166 #endif  /* ! APR_PROC_MUTEX_H */