brianp 2002/09/21 21:17:02
Modified: include apr_atomic.h
. CHANGES
Log:
Inline, mutex-free implementations of the rest of the atomic
functions for Linux/x86.
Revision Changes Path
1.37 +25 -0 apr/include/apr_atomic.h
Index: apr_atomic.h
===================================================================
RCS file: /home/cvs/apr/include/apr_atomic.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- apr_atomic.h 12 Sep 2002 13:29:50 -0000 1.36
+++ apr_atomic.h 22 Sep 2002 04:17:02 -0000 1.37
@@ -191,6 +191,31 @@
: "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
1.337 +4 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -r1.336 -r1.337
--- CHANGES 19 Sep 2002 05:31:40 -0000 1.336
+++ CHANGES 22 Sep 2002 04:17:02 -0000 1.337
@@ -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