18 #undef afw_lock_obtain
19 #undef afw_lock_release
20 #undef afw_lock_read_obtain
21 #undef afw_lock_read_release
22 #undef afw_lock_write_obtain
23 #undef afw_lock_write_release
34 apr_thread_mutex_destroy(self->mutex);
40 afw_lock_create_environment_lock(
53 self->lock_id = (lock_id)
55 : &afw_s_a_empty_string;
56 rv = apr_thread_mutex_create(&self->mutex,
58 if (rv != APR_SUCCESS) {
61 " apr_thread_mutex_create() failed",
83 insure_recursive_lock, xctx->env->p, xctx);
103 #ifdef AFW_LOCK_DEBUG
112 self->lock_id = (lock_id)
115 self->lock_type = (insure_recursive_lock)
116 ? afw_lock_type_thread_recursive_mutex
117 : afw_lock_type_thread_mutex;
119 self->description = description;
121 #ifdef AFW_LOCK_DEBUG
134 self->flag_id_debug, brief, description,
135 &afw_s_a_flag_debug_lock, xctx);
141 rv = apr_thread_mutex_create(&self->mutex,
142 ((insure_recursive_lock)
143 ? APR_THREAD_MUTEX_NESTED
144 : APR_THREAD_MUTEX_DEFAULT),
146 if (rv != APR_SUCCESS) {
149 " apr_thread_mutex_create() failed",
155 self, NULL, impl_lock_destroy, xctx);
163 impl_lock_destroy_rw(
169 apr_thread_rwlock_destroy(self->lock.rwlock);
202 #ifdef AFW_LOCK_DEBUG
208 self->lock.lock_id = (lock_id)
211 self->lock.brief = brief;
212 self->lock.description = description;
214 #ifdef AFW_LOCK_DEBUG
227 self->lock.flag_id_debug, brief, description,
228 &afw_s_a_flag_debug_lock, xctx);
231 self->lock.flag_index_debug = flag->
flag_index;
235 if (rv != APR_SUCCESS) {
238 " apr_thread_rwlock_create() failed",
244 self, NULL, impl_lock_destroy_rw, xctx);
259 if (!instance)
return;
261 rv = apr_thread_mutex_lock(self->mutex);
262 if (rv != APR_SUCCESS) {
265 " apr_thread_mutex_lock() failed",
276 if (!instance)
return;
296 if (!instance)
return;
298 rv = apr_thread_mutex_unlock(self->mutex);
299 if (rv != APR_SUCCESS) {
302 " apr_thread_mutex_unlock() failed",
313 if (!instance)
return;
333 if (!instance)
return;
335 rv = apr_thread_rwlock_rdlock(self->lock.rwlock);
336 if (rv != APR_SUCCESS) {
339 " apr_thread_rwlock_rdlock() failed",
350 if (!instance)
return;
371 if (!instance)
return;
373 rv = apr_thread_rwlock_unlock(self->lock.rwlock);
374 if (rv != APR_SUCCESS) {
377 " apr_thread_rwlock_unlock() failed",
388 if (!instance)
return;
408 if (!instance)
return;
410 rv = apr_thread_rwlock_wrlock(self->lock.rwlock);
411 if (rv != APR_SUCCESS) {
414 " apr_thread_rwlock_wrlock() failed",
425 if (!instance)
return;
443 if (!instance)
return;
445 rv = apr_thread_rwlock_unlock(self->lock.rwlock);
446 if (rv != APR_SUCCESS) {
449 " apr_thread_rwlock_unlock() failed",
460 if (!instance)
return;
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
afw_debug_write_fz(const afw_interface_implementation_rti_t *rti, const afw_utf8_z_t *source_z, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...)
Write debug using a printf style format.
void afw_environment_register_lock(const afw_utf8_t *lock_id, const afw_lock_t *lock, afw_xctx_t *xctx)
Register an lock.
#define afw_environment_register_flag(flag_id, brief, description, included_by_flag_id, xctx)
Register a flag.
const afw_flag_t * afw_environment_get_flag(const afw_utf8_t *flag_id, afw_xctx_t *xctx)
Get the flag instance associated with flag_id.
#define AFW_THROW_ERROR_RV_FZ(code, rv_source_id, rv, xctx, format_z,...)
Macro used to set error and rv in xctx and throw it.
#define afw_flag_is_active(flag_index, xctx)
Determine if flag for flag index is set in xctx.
afw_lock_write_obtain_debug(const afw_lock_rw_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of obtain write lock.
afw_lock_create_rw_and_register(const afw_utf8_t *lock_id, const afw_utf8_t *brief, const afw_utf8_t *description, afw_xctx_t *xctx)
Create a read/write lock and register in environment.
afw_lock_release(const afw_lock_t *instance, afw_xctx_t *xctx)
Release lock.
afw_lock_create_and_register(const afw_utf8_t *lock_id, const afw_utf8_t *brief, const afw_utf8_t *description, afw_boolean_t insure_recursive_lock, afw_xctx_t *xctx)
Create a lock and register in environment.
afw_lock_release_debug(const afw_lock_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of release lock.
afw_lock_read_release(const afw_lock_rw_t *instance, afw_xctx_t *xctx)
Release read lock.
afw_lock_write_release(const afw_lock_rw_t *instance, afw_xctx_t *xctx)
Release write lock.
afw_lock_write_obtain(const afw_lock_rw_t *instance, afw_xctx_t *xctx)
Obtain write lock.
afw_lock_create_rw(const afw_utf8_t *lock_id, const afw_utf8_t *brief, const afw_utf8_t *description, const afw_pool_t *p, afw_xctx_t *xctx)
Create a read/write lock that will last for life of pool.
afw_lock_read_obtain_debug(const afw_lock_rw_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of obtain read lock.
afw_lock_obtain(const afw_lock_t *instance, afw_xctx_t *xctx)
Obtain lock.
afw_lock_write_release_debug(const afw_lock_rw_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of release write lock.
afw_lock_read_obtain(const afw_lock_rw_t *instance, afw_xctx_t *xctx)
Obtain read lock.
afw_lock_read_release_debug(const afw_lock_rw_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of release read lock.
afw_lock_obtain_debug(const afw_lock_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
Debug version of obtain lock.
afw_lock_create(const afw_utf8_t *lock_id, const afw_utf8_t *brief, const afw_utf8_t *description, afw_boolean_t insure_recursive_lock, const afw_pool_t *p, afw_xctx_t *xctx)
Create a lock that will last for life of pool.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_register_cleanup_before(instance, data, data2, cleanup, xctx)
Call method register_cleanup_before of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
afw_utf8_printf(const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
Create a utf-8 string using a c format string in specified pool.
afw_uuid_create_utf8(const afw_pool_t *p, afw_xctx_t *xctx)
Create a UUID as a standard format UUID utf-8 string.
Struct used for a registered flag.
afw_size_t flag_index
Index of this flag in flags array.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Interface afw_xctx public struct.