Apache HTTPD
proc_mutex.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "apr.h"
18#include "apr_private.h"
19#include "apr_portable.h"
20#include "apr_arch_proc_mutex.h"
21#include "apr_arch_thread_mutex.h"
22
24 const char *fname,
27{
30 unsigned int flags = APR_THREAD_MUTEX_DEFAULT;
31
32 *mutex = NULL;
35 }
36 else if (mech != APR_LOCK_DEFAULT) {
37 return APR_ENOTIMPL;
38 }
39
41 if (new_mutex == NULL) {
42 return APR_ENOMEM;
43 }
44
47
48 if (ret == APR_SUCCESS)
49 *mutex = new_mutex;
50
51 return ret;
52}
53
55 const char *fname,
57{
58 return APR_SUCCESS;
59}
60
62{
63 if (mutex)
64 return apr_thread_mutex_lock(mutex->mutex);
65 return APR_ENOLOCK;
66}
67
69{
70 if (mutex)
71 return apr_thread_mutex_trylock(mutex->mutex);
72 return APR_ENOLOCK;
73}
74
77{
78 if (mutex)
80 return APR_ENOLOCK;
81}
82
84{
85 if (mutex)
86 return apr_thread_mutex_unlock(mutex->mutex);
87 return APR_ENOLOCK;
88}
89
91{
92 return apr_proc_mutex_destroy(mutex);
93}
94
96{
97 if (mutex)
98 return apr_thread_mutex_destroy(mutex->mutex);
99 return APR_ENOLOCK;
100}
101
103{
104 return NULL;
105}
106
111
113{
114 return "netwarethread";
115}
116
117APR_DECLARE(const char *) apr_proc_mutex_defname(void)
118{
119 return "netwarethread";
120}
121
123
125
126/* Implement OS-specific accessors defined in apr_portable.h */
127
131{
132 if (pmutex && pmutex->mutex)
134 return APR_ENOLOCK;
135#if 0
136 /* We need to change apr_os_proc_mutex_t to a pointer type
137 * to be able to implement this function.
138 */
140 if (mech) {
142 }
143 return APR_SUCCESS;
144#endif
145}
146
149{
151}
152
158{
159 if (pool == NULL) {
160 return APR_ENOPOOL;
161 }
163 return APR_ENOTIMPL;
164 }
165#if 0
166 /* We need to change apr_os_proc_mutex_t to a pointer type
167 * to be able to implement this function.
168 */
169 if ((*pmutex) == NULL) {
170 (*pmutex) = apr_pcalloc(pool, sizeof(apr_proc_mutex_t));
171 (*pmutex)->pool = pool;
172 }
173 (*pmutex)->mutex = apr_pcalloc(pool, sizeof(apr_thread_mutex_t));
174 (*pmutex)->mutex->mutex = *ospmutex;
175 (*pmutex)->mutex->pool = pool;
176
177 if (register_cleanup) {
180 }
181 return APR_SUCCESS;
182#else
183 return APR_ENOTIMPL;
184#endif
185}
186
190{
192 0, pool);
193}
194
APR Portability Routines.
#define APR_ENOMEM
Definition apr_errno.h:683
#define APR_ENOTIMPL
Definition apr_errno.h:476
#define APR_ENOLOCK
Definition apr_errno.h:303
#define APR_ENOPOOL
Definition apr_errno.h:290
const char apr_lockmech_e mech
const char apr_ssize_t int flags
Definition apr_encode.h:168
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
const char * fname
#define APR_PERMS_SET_ENOTIMPL(type)
#define APR_POOL_IMPLEMENT_ACCESSOR(type)
Definition apr_pools.h:91
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
apr_os_proc_mutex_t * ospmutex
apr_os_file_t int register_cleanup
apr_global_mutex_t * pmutex
apr_lockmech_e
@ APR_LOCK_DEFAULT_TIMED
@ APR_LOCK_DEFAULT
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
return NULL
Definition mod_so.c:359
apr_thread_mutex_t * mutex
apr_thread_mutex_t * mutex
static void proc_mutex(abts_case *tc, void *data)
IN ULONG IN INT timeout