diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:56:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:56:05 +0000 |
commit | a6c43c64d9419dfa888b1c478e658e3e20a4af11 (patch) | |
tree | c44233797692f5a1878dfd1d614e5674a3c0e0a6 /include/apr_proc_mutex.h | |
parent | f7eb533f85d0941dbf6edb3081f065e4c010b8cc (diff) |
Notes
Diffstat (limited to 'include/apr_proc_mutex.h')
-rw-r--r-- | include/apr_proc_mutex.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/apr_proc_mutex.h b/include/apr_proc_mutex.h index bb5b34f0c08c..418c95048a70 100644 --- a/include/apr_proc_mutex.h +++ b/include/apr_proc_mutex.h @@ -26,6 +26,7 @@ #include "apr_pools.h" #include "apr_errno.h" #include "apr_perms_set.h" +#include "apr_time.h" #ifdef __cplusplus extern "C" { @@ -48,7 +49,8 @@ typedef enum { APR_LOCK_SYSVSEM, /**< System V Semaphores */ APR_LOCK_PROC_PTHREAD, /**< POSIX pthread process-based locking */ APR_LOCK_POSIXSEM, /**< POSIX semaphore process-based locking */ - APR_LOCK_DEFAULT /**< Use the default process lock */ + APR_LOCK_DEFAULT, /**< Use the default process lock */ + APR_LOCK_DEFAULT_TIMED /**< Use the default process timed lock */ } apr_lockmech_e; /** Opaque structure representing a process mutex. */ @@ -114,6 +116,17 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex); APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex); /** + * Attempt to acquire the lock for the given mutex until timeout expires. + * If the acquisition time outs, the call returns with APR_TIMEUP. + * @param mutex the mutex on which to attempt the lock acquiring. + * @param timeout the relative timeout (microseconds). + * @note A negative or nul timeout means immediate attempt, returning + * APR_TIMEUP without blocking if it the lock is already acquired. + */ +APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex, + apr_interval_time_t timeout); + +/** * Release the lock for the given mutex. * @param mutex the mutex from which to release the lock. */ |