apr_global_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_GLOBAL_MUTEX_H
00018 #define APR_GLOBAL_MUTEX_H
00019 
00025 #include "apr.h"
00026 #include "apr_proc_mutex.h"    /* only for apr_lockmech_e */
00027 #include "apr_pools.h"
00028 #include "apr_errno.h"
00029 #if APR_PROC_MUTEX_IS_GLOBAL
00030 #include "apr_proc_mutex.h"
00031 #endif
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif /* __cplusplus */
00036 
00043 #if !APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
00044 
00046 typedef struct apr_global_mutex_t apr_global_mutex_t;
00047 
00048 /*   Function definitions */
00049 
00074 APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex,
00075                                                   const char *fname,
00076                                                   apr_lockmech_e mech,
00077                                                   apr_pool_t *pool);
00078 
00090 APR_DECLARE(apr_status_t) apr_global_mutex_child_init(
00091                               apr_global_mutex_t **mutex,
00092                               const char *fname,
00093                               apr_pool_t *pool);
00094 
00100 APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex);
00101 
00109 APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex);
00110 
00115 APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex);
00116 
00121 APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex);
00122 
00127 APR_POOL_DECLARE_ACCESSOR(global_mutex);
00128 
00129 #else /* APR_PROC_MUTEX_IS_GLOBAL */
00130 
00131 /* Some platforms [e.g. Win32] have cross process locks that are truly
00132  * global locks, since there isn't the concept of cross-process locks.
00133  * Define these platforms in terms of an apr_proc_mutex_t.
00134  */
00135 
00136 #define apr_global_mutex_t          apr_proc_mutex_t
00137 #define apr_global_mutex_create     apr_proc_mutex_create
00138 #define apr_global_mutex_child_init apr_proc_mutex_child_init
00139 #define apr_global_mutex_lock       apr_proc_mutex_lock
00140 #define apr_global_mutex_trylock    apr_proc_mutex_trylock
00141 #define apr_global_mutex_unlock     apr_proc_mutex_unlock
00142 #define apr_global_mutex_destroy    apr_proc_mutex_destroy
00143 #define apr_global_mutex_pool_get   apr_proc_mutex_pool_get
00144 
00145 #endif
00146 
00149 #ifdef __cplusplus
00150 }
00151 #endif
00152 
00153 #endif  /* ndef APR_GLOBAL_MUTEX_H */

Generated on Mon Nov 26 11:47:26 2007 for Apache Portable Runtime by  doxygen 1.5.2