You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ro...@apache.org on 2006/09/25 18:32:03 UTC
svn commit: r449724 - in /apr/apr/branches/0.9.x: CHANGES
atomic/unix/apr_atomic.c
Author: rooneg
Date: Mon Sep 25 09:32:02 2006
New Revision: 449724
URL: http://svn.apache.org/viewvc?view=rev&rev=449724
Log:
Fix apr_atomic_cas on platforms with 64 bit longs.
This is being committed to 0.9.x directly because it is no longer applicable
to the 1.x branches.
Submitted by: Philip Martin <philip codematters.co.uk>
* atomic/unix/apr_atomic.c
(apr_atomic_cas): Truncate 64 bit argument values.
* CHANGES: Note change.
Modified:
apr/apr/branches/0.9.x/CHANGES
apr/apr/branches/0.9.x/atomic/unix/apr_atomic.c
Modified: apr/apr/branches/0.9.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/CHANGES?view=diff&rev=449724&r1=449723&r2=449724
==============================================================================
--- apr/apr/branches/0.9.x/CHANGES (original)
+++ apr/apr/branches/0.9.x/CHANGES Mon Sep 25 09:32:02 2006
@@ -1,5 +1,8 @@
Changes with APR 0.9.13
+ *) Fix apr_atomic_cas on platforms with 64 bit longs.
+ [Philip Martin <philip codematters.co.uk>]
+
*) Provide folding in autogenerated .manifest files for Win32 builders
using VisualStudio 2005 [William Rowe]
Modified: apr/apr/branches/0.9.x/atomic/unix/apr_atomic.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/atomic/unix/apr_atomic.c?view=diff&rev=449724&r1=449723&r2=449724
==============================================================================
--- apr/apr/branches/0.9.x/atomic/unix/apr_atomic.c (original)
+++ apr/apr/branches/0.9.x/atomic/unix/apr_atomic.c Mon Sep 25 09:32:02 2006
@@ -123,23 +123,23 @@
#if !defined(apr_atomic_cas) && !defined(APR_OVERRIDE_ATOMIC_CAS)
apr_uint32_t apr_atomic_cas(volatile apr_uint32_t *mem, long with, long cmp)
{
- long prev;
+ apr_uint32_t prev;
#if APR_HAS_THREADS
apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)];
if (apr_thread_mutex_lock(lock) == APR_SUCCESS) {
- prev = *(long*)mem;
- if (prev == cmp) {
- *(long*)mem = with;
+ prev = *mem;
+ if (prev == (apr_uint32_t)cmp) {
+ *mem = (apr_uint32_t)with;
}
apr_thread_mutex_unlock(lock);
return prev;
}
- return *(long*)mem;
+ return *mem;
#else
- prev = *(long*)mem;
- if (prev == cmp) {
- *(long*)mem = with;
+ prev = *mem;
+ if (prev == (apr_uint32_t)cmp) {
+ *mem = (apr_uint32_t)with;
}
return prev;
#endif /* APR_HAS_THREADS */