aboutsummaryrefslogtreecommitdiffstats
path: root/include/apr_thread_mutex.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
commita6c43c64d9419dfa888b1c478e658e3e20a4af11 (patch)
treec44233797692f5a1878dfd1d614e5674a3c0e0a6 /include/apr_thread_mutex.h
parentf7eb533f85d0941dbf6edb3081f065e4c010b8cc (diff)
downloadsrc-vendor/apr.tar.gz
src-vendor/apr.zip
Vendor import apr-1.7.0vendor/apr/apr-1.7.0vendor/apr
Notes
Notes: svn path=/vendor/apr/dist/; revision=361666 svn path=/vendor/apr/apr-1.7.0/; revision=361667; tag=vendor/apr/apr-1.7.0
Diffstat (limited to 'include/apr_thread_mutex.h')
-rw-r--r--include/apr_thread_mutex.h13
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.
*/