diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | include/apr_atomic.h | 25 |
2 files changed, 29 insertions, 0 deletions
@@ -1,5 +1,9 @@ Changes with APR 0.9.2 + *) Faster (inline and mutex-free) implementations of all apr_atomic + operations for Linux/x86 (requires a 486 or later; to enable, + configure APR with --enable-nonportable-atomics=yes ) [Brian Pane] + *) Add --bindir option to apr-config. [Justin Erenkrantz] *) Begin to rehash the test suite. There is now a new test program called diff --git a/include/apr_atomic.h b/include/apr_atomic.h index bddbd2579..9a3eb43c3 100644 --- a/include/apr_atomic.h +++ b/include/apr_atomic.h @@ -191,6 +191,31 @@ APR_DECLARE(int) apr_atomic_dec(apr_atomic_t *mem); : "memory"); \ prev;}) +#define apr_atomic_add(mem, val) \ +({ register apr_atomic_t last; \ + do { \ + last = *(mem); \ + } while (apr_atomic_cas((mem), last + (val), last) != last); \ + }) + +#define apr_atomic_dec(mem) \ +({ register apr_atomic_t last; \ + do { \ + last = *(mem); \ + } while (apr_atomic_cas((mem), last - 1, last) != last); \ + (--last != 0); }) + +#define apr_atomic_inc(mem) \ +({ register apr_atomic_t last; \ + do { \ + last = *(mem); \ + } while (apr_atomic_cas((mem), last + 1, last) != last); \ + }) + +#define apr_atomic_set(mem, val) (*(mem) = val) +#define apr_atomic_read(mem) (*(mem)) +#define apr_atomic_init(pool) APR_SUCCESS + #elif (defined(__sparc__) || defined(sparc)) && !APR_FORCE_ATOMIC_GENERIC #define apr_atomic_t apr_uint32_t |