You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/01/03 18:18:50 UTC
[19/50] git commit: TS-2454: Fix undefined reference to
`__sync_fetch_and_sub_8' on ARM 32bit system
TS-2454: Fix undefined reference to `__sync_fetch_and_sub_8' on ARM 32bit system
Signed-off-by: Yunkai Zhang <yu...@redstar.celldoft.com>
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8d8507f3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8d8507f3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8d8507f3
Branch: refs/heads/5.0.x
Commit: 8d8507f3fb9108fdc58b8e7da924b12de8fcbcd0
Parents: a477817
Author: Yunkai Zhang <yu...@redstar.celldoft.com>
Authored: Sat Dec 28 19:59:33 2013 +0800
Committer: Yunkai Zhang <qi...@taobao.com>
Committed: Sat Dec 28 20:10:16 2013 +0800
----------------------------------------------------------------------
CHANGES | 2 ++
lib/ts/ink_atomic.h | 39 ++++++++++++++++++++++++++++++++-------
2 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8d8507f3/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c17904a..29079c0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 4.2.0
+ *) TS-2454: Fix undefined reference to `__sync_fetch_and_sub_8' on ARM 32bit system.
+
*) [TS-2450] Fix assertion failure for T61String type.
*) [TS-2117] make hipes plugin build
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8d8507f3/lib/ts/ink_atomic.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_atomic.h b/lib/ts/ink_atomic.h
index 51d87c0..fc8a9f3 100644
--- a/lib/ts/ink_atomic.h
+++ b/lib/ts/ink_atomic.h
@@ -50,6 +50,7 @@ typedef volatile int8_t vint8;
typedef volatile int16_t vint16;
typedef volatile int32_t vint32;
typedef volatile int64_t vint64;
+typedef volatile uint64_t vuint64;
typedef volatile long vlong;
typedef volatile void *vvoidp;
@@ -57,6 +58,7 @@ typedef vint8 *pvint8;
typedef vint16 *pvint16;
typedef vint32 *pvint32;
typedef vint64 *pvint64;
+typedef vuint64 *pvuint64;
typedef vlong *pvlong;
typedef vvoidp *pvvoidp;
@@ -194,9 +196,8 @@ ink_atomic_cas<int64_t>(pvint64 mem, int64_t old, int64_t new_value) {
return 0;
}
-template<>
-inline int64_t
-ink_atomic_increment<int64_t>(pvint64 mem, int64_t value) {
+template<typename Amount> static inline int64_t
+ink_atomic_increment(pvint64 mem, Amount value) {
int64_t curr;
ink_mutex_acquire(&__global_death);
curr = *mem;
@@ -205,10 +206,34 @@ ink_atomic_increment<int64_t>(pvint64 mem, int64_t value) {
return curr;
}
-template<>
-inline int64_t
-ink_atomic_increment<int64_t>(pvint64 mem, int value) {
- return ink_atomic_increment(mem, static_cast<int64_t>(value));
+template<typename Amount> static inline int64_t
+ink_atomic_decrement(pvint64 mem, Amount value) {
+ int64_t curr;
+ ink_mutex_acquire(&__global_death);
+ curr = *mem;
+ *mem = curr - value;
+ ink_mutex_release(&__global_death);
+ return curr;
+}
+
+template<typename Amount> static inline uint64_t
+ink_atomic_increment(pvuint64 mem, Amount value) {
+ uint64_t curr;
+ ink_mutex_acquire(&__global_death);
+ curr = *mem;
+ *mem = curr + value;
+ ink_mutex_release(&__global_death);
+ return curr;
+}
+
+template<typename Amount> static inline uint64_t
+ink_atomic_decrement(pvuint64 mem, Amount value) {
+ uint64_t curr;
+ ink_mutex_acquire(&__global_death);
+ curr = *mem;
+ *mem = curr - value;
+ ink_mutex_release(&__global_death);
+ return curr;
}
#endif /* Special hacks for ARM 32-bit */