summaryrefslogtreecommitdiff
path: root/atomic
diff options
context:
space:
mode:
authorgregames <gregames@13f79535-47bb-0310-9956-ffa450edef68>2002-03-19 22:42:30 +0000
committergregames <gregames@13f79535-47bb-0310-9956-ffa450edef68>2002-03-19 22:42:30 +0000
commit74ab70ab9fd229c67b0cf3666aeb74ea37822ffa (patch)
tree1df3e3dd3f5f1192d1584d9dd8c935c26109427e /atomic
parent7cfe5847818d0236013432977f2d22b1534011de (diff)
downloadlibapr-74ab70ab9fd229c67b0cf3666aeb74ea37822ffa.tar.gz
apr_atomic_dec: change the fallback version to return the new value of
the memory variable. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63161 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r--atomic/unix/apr_atomic.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/atomic/unix/apr_atomic.c b/atomic/unix/apr_atomic.c
index 686b19bf6..aa35a0d91 100644
--- a/atomic/unix/apr_atomic.c
+++ b/atomic/unix/apr_atomic.c
@@ -126,13 +126,13 @@ void apr_atomic_inc( volatile apr_uint32_t *mem)
int apr_atomic_dec(volatile apr_atomic_t *mem)
{
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
- apr_uint32_t prev;
+ apr_uint32_t new;
if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
- prev = *mem;
(*mem)--;
+ new = *mem;
apr_thread_mutex_unlock(lock);
- return prev;
+ return new;
}
return *mem;
}