Apache Portable Runtime
Data Structures | Macros | Typedefs
apr_anylock.h File Reference

APR-Util transparent any lock flavor wrapper. More...

#include "apr_proc_mutex.h"
#include "apr_thread_mutex.h"
#include "apr_thread_rwlock.h"

Go to the source code of this file.

Data Structures

struct  apr_anylock_t
 
union  apr_anylock_t::apr_anylock_u_t
 

Macros

#define APR_ANYLOCK_LOCK(lck)
 
#define APR_ANYLOCK_TRYLOCK(lck)
 
#define APR_ANYLOCK_UNLOCK(lck)
 

Typedefs

typedef struct apr_anylock_t apr_anylock_t
 

Detailed Description

APR-Util transparent any lock flavor wrapper.

Macro Definition Documentation

#define APR_ANYLOCK_LOCK (   lck)
Value:
(((lck)->type == apr_anylock_none) \
: (((lck)->type == apr_anylock_threadmutex) \
? apr_thread_mutex_lock((lck)->lock.tm) \
: (((lck)->type == apr_anylock_procmutex) \
? apr_proc_mutex_lock((lck)->lock.pm) \
: (((lck)->type == apr_anylock_readlock) \
? apr_thread_rwlock_rdlock((lck)->lock.rw) \
: (((lck)->type == apr_anylock_writelock) \
? apr_thread_rwlock_wrlock((lck)->lock.rw) \
: APR_EINVAL)))))
apr_status_t apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
apr_status_t apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock)
apr_status_t apr_proc_mutex_lock(apr_proc_mutex_t *mutex)
apr_status_t apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock)
#define APR_SUCCESS
Definition: apr_errno.h:225
#define APR_EINVAL
Definition: apr_errno.h:717

Lock an apr_anylock_t structure

#define APR_ANYLOCK_TRYLOCK (   lck)
Value:
(((lck)->type == apr_anylock_none) \
: (((lck)->type == apr_anylock_threadmutex) \
? apr_thread_mutex_trylock((lck)->lock.tm) \
: (((lck)->type == apr_anylock_procmutex) \
? apr_proc_mutex_trylock((lck)->lock.pm) \
: (((lck)->type == apr_anylock_readlock) \
? apr_thread_rwlock_tryrdlock((lck)->lock.rw) \
: (((lck)->type == apr_anylock_writelock) \
? apr_thread_rwlock_trywrlock((lck)->lock.rw) \
: APR_EINVAL)))))
apr_status_t apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock)
apr_status_t apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock)
apr_status_t apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
#define APR_SUCCESS
Definition: apr_errno.h:225
apr_status_t apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
#define APR_EINVAL
Definition: apr_errno.h:717

Try to lock an apr_anylock_t structure

#define APR_ANYLOCK_UNLOCK (   lck)
Value:
(((lck)->type == apr_anylock_none) \
: (((lck)->type == apr_anylock_threadmutex) \
? apr_thread_mutex_unlock((lck)->lock.tm) \
: (((lck)->type == apr_anylock_procmutex) \
? apr_proc_mutex_unlock((lck)->lock.pm) \
: ((((lck)->type == apr_anylock_readlock) || \
((lck)->type == apr_anylock_writelock)) \
? apr_thread_rwlock_unlock((lck)->lock.rw) \
: APR_EINVAL))))
apr_status_t apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock)
apr_status_t apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)
apr_status_t apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
#define APR_SUCCESS
Definition: apr_errno.h:225
#define APR_EINVAL
Definition: apr_errno.h:717

Unlock an apr_anylock_t structure

Typedef Documentation

typedef struct apr_anylock_t apr_anylock_t

Structure that may contain any APR lock type