diff options
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. */ |