00001 /* Copyright 2000-2004 The Apache Software Foundation 00002 * 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * http://www.apache.org/licenses/LICENSE-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 00014 */ 00015 00016 #ifndef APR_GLOBAL_MUTEX_H 00017 #define APR_GLOBAL_MUTEX_H 00018 00024 #include "apr.h" 00025 #include "apr_proc_mutex.h" /* only for apr_lockmech_e */ 00026 #include "apr_pools.h" 00027 #include "apr_errno.h" 00028 #if APR_PROC_MUTEX_IS_GLOBAL 00029 #include "apr_proc_mutex.h" 00030 #endif 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif /* __cplusplus */ 00035 00042 #if !APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN) 00043 00045 typedef struct apr_global_mutex_t apr_global_mutex_t; 00046 00047 /* Function definitions */ 00048 00073 APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex, 00074 const char *fname, 00075 apr_lockmech_e mech, 00076 apr_pool_t *pool); 00077 00089 APR_DECLARE(apr_status_t) apr_global_mutex_child_init( 00090 apr_global_mutex_t **mutex, 00091 const char *fname, 00092 apr_pool_t *pool); 00093 00099 APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex); 00100 00108 APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex); 00109 00114 APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex); 00115 00120 APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex); 00121 00126 APR_POOL_DECLARE_ACCESSOR(global_mutex); 00127 00128 #else /* APR_PROC_MUTEX_IS_GLOBAL */ 00129 00130 /* Some platforms [e.g. Win32] have cross process locks that are truly 00131 * global locks, since there isn't the concept of cross-process locks. 00132 * Define these platforms in terms of an apr_proc_mutex_t. 00133 */ 00134 00135 #define apr_global_mutex_t apr_proc_mutex_t 00136 #define apr_global_mutex_create apr_proc_mutex_create 00137 #define apr_global_mutex_child_init apr_proc_mutex_child_init 00138 #define apr_global_mutex_lock apr_proc_mutex_lock 00139 #define apr_global_mutex_trylock apr_proc_mutex_trylock 00140 #define apr_global_mutex_unlock apr_proc_mutex_unlock 00141 #define apr_global_mutex_destroy apr_proc_mutex_destroy 00142 #define apr_global_mutex_pool_get apr_proc_mutex_pool_get 00143 00144 #endif 00145 00148 #ifdef __cplusplus 00149 } 00150 #endif 00151 00152 #endif /* ndef APR_GLOBAL_MUTEX_H */