diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2001-06-26 02:05:05 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2001-06-26 02:05:05 +0000 |
commit | 7609814b51ea4b1da52ba79ad6b213726aeda684 (patch) | |
tree | ed95ce1fd1faaece9e48491cf8a14495c9cc8168 /include | |
parent | 6ca3bd2d7834c9f1fc9c1d4cc5805370190df7c5 (diff) | |
download | libapr-7609814b51ea4b1da52ba79ad6b213726aeda684.tar.gz |
Add apr_lock_create_np() (Unix only, for now) which allows the caller to
specify the mechanism used for the interprocess lock (if any).
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61797 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/apr.h.in | 2 | ||||
-rw-r--r-- | include/apr.hw | 2 | ||||
-rw-r--r-- | include/apr_lock.h | 48 |
3 files changed, 52 insertions, 0 deletions
diff --git a/include/apr.h.in b/include/apr.h.in index cad4c09d8..db8277db1 100644 --- a/include/apr.h.in +++ b/include/apr.h.in @@ -64,6 +64,8 @@ #define APR_USE_PROC_PTHREAD_SERIALIZE @procpthreadser@ #define APR_USE_PTHREAD_SERIALIZE @pthreadser@ +#define APR_HAS_LOCK_CREATE_NP @lockcreatenp@ + #define APR_PROCESS_LOCK_IS_GLOBAL @proclockglobal@ #define APR_USES_ANONYMOUS_SHM @anonymous_shm@ diff --git a/include/apr.hw b/include/apr.hw index 2eda87a8c..7cc8b1a0f 100644 --- a/include/apr.hw +++ b/include/apr.hw @@ -157,6 +157,8 @@ #define APR_USE_PROC_PTHREAD_SERIALIZE 0 #define APR_USE_PTHREAD_SERIALIZE 0 +#define APR_HAS_LOCK_CREATE_NP 0 + #define APR_PROCESS_LOCK_IS_GLOBAL 0 #define APR_USES_ANONYMOUS_SHM 0 diff --git a/include/apr_lock.h b/include/apr_lock.h index b3f0dff87..fd3439b36 100644 --- a/include/apr_lock.h +++ b/include/apr_lock.h @@ -178,6 +178,54 @@ APR_DECLARE(apr_status_t) apr_lock_data_set(apr_lock_t *lock, void *data, const char *key, apr_status_t (*cleanup)(void *)); +#if APR_HAS_LOCK_CREATE_NP + +typedef enum {APR_LOCK_FCNTL, APR_LOCK_FLOCK, APR_LOCK_SYSVSEM, APR_LOCK_PROC_PTHREAD, + APR_LOCK_DEFAULT} apr_lockmech_e_np; + +/** + * non-portable interface to apr_lock_create() + * + * Create a new instance of a lock structure. This is like apr_lock_create() + * but has some non-portable parameters. This should be used sparingly. + * + * @param lock The newly created lock structure. + * @param type The type of lock to create, one of: + * <PRE> + * APR_MUTEX + * APR_READWRITE + * </PRE> + * @param scope The scope of the lock to create, one of: + * <PRE> + * APR_CROSS_PROCESS lock processes from the protected area. + * APR_INTRAPROCESS lock threads from the protected area. + * APR_LOCKALL lock processes and threads from the + * protected area. + * </PRE> + * @param mech The mechanism to use for the interprocess lock, if any; one of + * <PRE> + * APR_LOCK_FCNTL + * APR_LOCK_FLOCK + * APR_LOCK_SYSVSEM + * APR_LOCK_PROC_PTHREAD + * APR_LOCK_DEFAULT pick the default mechanism for the platform + * </PRE> + * @param fname A file name to use if the lock mechanism requires one. This + * argument should always be provided. The lock code itself will + * determine if it should be used. + * @param pool The pool to operate on. + * @tip APR_CROSS_PROCESS may lock both processes and threads, but it is + * only guaranteed to lock processes. + * @deffunc apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_lockscope_e scope, const char *fname, apr_pool_t *pool) + */ +APR_DECLARE(apr_status_t) apr_lock_create_np(apr_lock_t **lock, + apr_locktype_e type, + apr_lockscope_e scope, + apr_lockmech_e_np mech, + const char *fname, + apr_pool_t *pool); +#endif /* APR_HAS_LOCK_CREATE_NP */ + #ifdef __cplusplus } #endif |