summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2019-01-17 16:04:55 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2019-01-17 16:04:55 +0000
commit724388969ef203d0cfed72dc3c337584525deba1 (patch)
treea65dc86f217d3dcb2fd078edff5527180fd9588f
parentc77a92dd1ae85ee6dba132c88ad4ada23ecae359 (diff)
downloadlibapr-724388969ef203d0cfed72dc3c337584525deba1.tar.gz
atomics: follow up to r1841078: provide specific initializer for generic 64bit
The can't be two apr_atomic_init(), atomic/mutex64.c shouldn't implement one since generic/mutex implementation may be used by several platforms. So introduce private apr__atomic_generic64_init() and use it where needed. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1851541 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--atomic/netware/apr_atomic.c7
-rw-r--r--atomic/os390/atomic.c8
-rw-r--r--atomic/unix/ia32.c4
-rw-r--r--atomic/unix/mutex.c5
-rw-r--r--atomic/unix/mutex64.c5
-rw-r--r--atomic/unix/ppc.c4
-rw-r--r--atomic/unix/s390.c4
-rw-r--r--atomic/unix/solaris.c4
-rw-r--r--atomic/win32/apr_atomic.c8
-rw-r--r--include/arch/unix/apr_arch_atomic.h8
10 files changed, 43 insertions, 14 deletions
diff --git a/atomic/netware/apr_atomic.c b/atomic/netware/apr_atomic.c
index d7e00cd4e..9785fd3c2 100644
--- a/atomic/netware/apr_atomic.c
+++ b/atomic/netware/apr_atomic.c
@@ -14,14 +14,17 @@
* limitations under the License.
*/
-#include "apr.h"
-#include "apr_atomic.h"
+#include "apr_arch_atomic.h"
#include <stdlib.h>
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *pool)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
diff --git a/atomic/os390/atomic.c b/atomic/os390/atomic.c
index 8fd158602..249ee15c2 100644
--- a/atomic/os390/atomic.c
+++ b/atomic/os390/atomic.c
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-
-#include "apr.h"
-#include "apr_atomic.h"
+#include "apr_arch_atomic.h"
#include <stdlib.h>
apr_status_t apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
diff --git a/atomic/unix/ia32.c b/atomic/unix/ia32.c
index 9941af5f5..df23d823e 100644
--- a/atomic/unix/ia32.c
+++ b/atomic/unix/ia32.c
@@ -20,7 +20,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/mutex.c b/atomic/unix/mutex.c
index 4ec5451e1..78ad75336 100644
--- a/atomic/unix/mutex.c
+++ b/atomic/unix/mutex.c
@@ -15,6 +15,7 @@
*/
#include "apr_arch_atomic.h"
+#include "apr_thread_mutex.h"
#ifdef USE_ATOMICS_GENERIC
@@ -70,7 +71,7 @@ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
}
}
- return APR_SUCCESS;
+ return apr__atomic_generic64_init(p);
}
static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem)
@@ -88,7 +89,7 @@ static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem)
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
- return APR_SUCCESS;
+ return apr__atomic_generic64_init(p);
}
#endif /* APR_HAS_THREADS */
diff --git a/atomic/unix/mutex64.c b/atomic/unix/mutex64.c
index 10452413b..9fc44af61 100644
--- a/atomic/unix/mutex64.c
+++ b/atomic/unix/mutex64.c
@@ -15,6 +15,7 @@
*/
#include "apr_arch_atomic.h"
+#include "apr_thread_mutex.h"
#if defined(USE_ATOMICS_GENERIC) || defined (NEED_ATOMICS_GENERIC64)
@@ -50,7 +51,7 @@ static apr_status_t atomic_cleanup(void *data)
return APR_SUCCESS;
}
-APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p)
{
int i;
apr_status_t rv;
@@ -86,7 +87,7 @@ static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint64_t *mem)
#else
-APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p)
{
return APR_SUCCESS;
}
diff --git a/atomic/unix/ppc.c b/atomic/unix/ppc.c
index 87c6900d3..55bbdd50c 100644
--- a/atomic/unix/ppc.c
+++ b/atomic/unix/ppc.c
@@ -26,7 +26,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/s390.c b/atomic/unix/s390.c
index cc139b837..d20de5987 100644
--- a/atomic/unix/s390.c
+++ b/atomic/unix/s390.c
@@ -20,7 +20,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/solaris.c b/atomic/unix/solaris.c
index a160f6808..4a2e1b8ad 100644
--- a/atomic/unix/solaris.c
+++ b/atomic/unix/solaris.c
@@ -22,7 +22,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/win32/apr_atomic.c b/atomic/win32/apr_atomic.c
index 9228d0a3d..75abf92e9 100644
--- a/atomic/win32/apr_atomic.c
+++ b/atomic/win32/apr_atomic.c
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-#include "apr.h"
-#include "apr_atomic.h"
-#include "apr_thread_mutex.h"
+#include "apr_arch_atomic.h"
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
diff --git a/include/arch/unix/apr_arch_atomic.h b/include/arch/unix/apr_arch_atomic.h
index b590ab239..6c1b2c63a 100644
--- a/include/arch/unix/apr_arch_atomic.h
+++ b/include/arch/unix/apr_arch_atomic.h
@@ -18,9 +18,9 @@
#define ATOMIC_H
#include "apr.h"
+#include "apr_pools.h"
#include "apr_private.h"
#include "apr_atomic.h"
-#include "apr_thread_mutex.h"
#if defined(USE_ATOMICS_GENERIC)
/* noop */
@@ -32,6 +32,7 @@
# define USE_ATOMICS_BUILTINS
#elif defined(SOLARIS2) && SOLARIS2 >= 10
# define USE_ATOMICS_SOLARIS
+# define NEED_ATOMICS_GENERIC64
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
# define USE_ATOMICS_IA32
# define NEED_ATOMICS_GENERIC64
@@ -43,7 +44,10 @@
# define NEED_ATOMICS_GENERIC64
#else
# define USE_ATOMICS_GENERIC
-# define NEED_ATOMICS_GENERIC64
+#endif
+
+#if defined(USE_ATOMICS_GENERIC) || defined (NEED_ATOMICS_GENERIC64)
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p);
#endif
#endif /* ATOMIC_H */