summaryrefslogtreecommitdiff
path: root/include/apr_portable.h
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2016-03-06 00:19:51 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2016-03-06 00:19:51 +0000
commit48b165c02e395250c3d12a55d07ed0b6c8cdf039 (patch)
tree976669566fec3c84f71506cbd1797ee26f8ab426 /include/apr_portable.h
parent790c11558d32066381aa00a6f903f7bfe82c0d53 (diff)
downloadlibapr-48b165c02e395250c3d12a55d07ed0b6c8cdf039.tar.gz
apr_proc/global_mutex: Fix API regarding the native OS mutexes
accessors from/to available APR mechanisms, adding the new functions apr_os_proc_mutex_get_ex() and apr_os_proc_mutex_set_ex() which give control to the user over the selected mechanisms, including the missing POSIX semaphores (sem_t) on platforms supporting them. For POSIX sems, this moves the "sem_t *psem_interproc;" member from struct apr_proc_mutex_t to apr_os_proc_mutex_t (now complete) so that we can avoid members duplication between the two structs, and hence replace all the doublons in apr_os_proc_mutex_t with an apr_os_proc_mutex_t member, called "os", to be used for runtime. This first commit aims to be backportable to 1.6.x, thus does not address the Netware case which requires an incompatible change of the apr_proc_mutex_t to a pointer type (the implementation is here since very similar to other changes is this commit, but it is commented out for now, a simple follow up is coming with the type change for trunk only...). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1733775 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apr_portable.h')
-rw-r--r--include/apr_portable.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/apr_portable.h b/include/apr_portable.h
index 98e19bfec..7ba8215ad 100644
--- a/include/apr_portable.h
+++ b/include/apr_portable.h
@@ -46,6 +46,9 @@
#if APR_HAVE_PTHREAD_H
#include <pthread.h>
#endif
+#if APR_HAVE_SEMAPHORE_H
+#include <semaphore.h>
+#endif
#ifdef __cplusplus
extern "C" {
@@ -140,6 +143,10 @@ struct apr_os_proc_mutex_t {
pthread_mutex_t *intraproc;
#endif
#endif
+#if APR_HAS_POSIXSEM_SERIALIZE
+ /** Value used for POSIX semaphores serialization */
+ sem_t *psem_interproc;
+#endif
};
typedef int apr_os_file_t; /**< native file */
@@ -241,7 +248,7 @@ APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
apr_socket_t *sock);
/**
- * Convert the proc mutex from os specific type to apr type
+ * Convert the proc mutex from apr type to os specific type
* @param ospmutex The os specific proc mutex we are converting to.
* @param pmutex The apr proc mutex to convert.
*/
@@ -249,6 +256,19 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
apr_proc_mutex_t *pmutex);
/**
+ * Convert the proc mutex from apr type to os specific type, also
+ * providing the mechanism used by the apr mutex.
+ * @param ospmutex The os specific proc mutex we are converting to.
+ * @param pmutex The apr proc mutex to convert.
+ * @param mech The mechanism used by the apr proc mutex (if not NULL).
+ * @remark Allows for disambiguation for platforms with multiple mechanisms
+ * available.
+ */
+APR_DECLARE(apr_status_t) apr_os_proc_mutex_get_ex(apr_os_proc_mutex_t *ospmutex,
+ apr_proc_mutex_t *pmutex,
+ apr_lockmech_e *mech);
+
+/**
* Get the exploded time in the platforms native format.
* @param ostime the native time format
* @param aprtime the time to convert
@@ -419,6 +439,21 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
apr_pool_t *cont);
/**
+ * Convert the proc mutex from os specific type to apr type, using the
+ * specified mechanism.
+ * @param pmutex The apr proc mutex we are converting to.
+ * @param ospmutex The os specific proc mutex to convert.
+ * @param mech The apr mutex locking mechanism
+ * @param cont The pool to use if it is needed.
+ * @remark Allows for disambiguation for platforms with multiple mechanisms
+ * available.
+ */
+APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
+ apr_os_proc_mutex_t *ospmutex,
+ apr_lockmech_e mech,
+ apr_pool_t *cont);
+
+/**
* Put the imploded time in the APR format.
* @param aprtime the APR time format
* @param ostime the time to convert