diff options
Diffstat (limited to 'include/apr_thread_mutex.h')
-rw-r--r-- | include/apr_thread_mutex.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/apr_thread_mutex.h b/include/apr_thread_mutex.h index 193a70a3822c..8eb617291b82 100644 --- a/include/apr_thread_mutex.h +++ b/include/apr_thread_mutex.h @@ -43,9 +43,11 @@ typedef struct apr_thread_mutex_t apr_thread_mutex_t; #define APR_THREAD_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ #define APR_THREAD_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */ #define APR_THREAD_MUTEX_UNNESTED 0x2 /**< disable nested locks */ +#define APR_THREAD_MUTEX_TIMED 0x4 /**< enable timed locks */ /* Delayed the include to avoid a circular reference */ #include "apr_pools.h" +#include "apr_time.h" /** * Create and initialize a mutex that can be used to synchronize threads. @@ -82,6 +84,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex); APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_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 timeout negative or nul means immediate attempt, returning + * APR_TIMEUP without blocking if it the lock is already acquired. + */ +APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_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. */ |