diff options
-rw-r--r-- | NWGNUmakefile | 5 | ||||
-rw-r--r-- | include/apr_atomic.h | 20 |
2 files changed, 16 insertions, 9 deletions
diff --git a/NWGNUmakefile b/NWGNUmakefile index 28032e28b..b57e51dbb 100644 --- a/NWGNUmakefile +++ b/NWGNUmakefile @@ -236,7 +236,6 @@ FILES_nlm_exports = \ # Paths must all use the '/' character # FILES_lib_objs = \ - $(OBJDIR)/apr_atomic.o \ $(OBJDIR)/apr_cpystrn.o \ $(OBJDIR)/apr_fnmatch.o \ $(OBJDIR)/apr_getpass.o \ @@ -316,10 +315,6 @@ install :: nlms FORCE # Any specialized rules here # -$(OBJDIR)/%.o: atomic/netware/%.c $(OBJDIR)\cc.opt - @echo Compiling $< - $(CC) atomic\netware\$(<F) -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt - $(OBJDIR)/%.o: strings/%.c $(OBJDIR)\cc.opt @echo Compiling $< $(CC) strings\$(<F) -o=$(OBJDIR)\$(@F) @$(OBJDIR)\cc.opt diff --git a/include/apr_atomic.h b/include/apr_atomic.h index b6737de98..c58b1fc6e 100644 --- a/include/apr_atomic.h +++ b/include/apr_atomic.h @@ -173,15 +173,27 @@ typedef LONG apr_atomic_t; #define apr_atomic_t unsigned long #define apr_atomic_add(mem, val) atomic_add(mem,val) -APR_DECLARE(int) apr_atomic_dec(apr_atomic_t *mem); -#define APR_OVERRIDE_ATOMIC_DEC 1 -#define APR_OVERRIDE_ATOMIC_CASPTR 1 #define apr_atomic_inc(mem) atomic_inc(mem) #define apr_atomic_set(mem, val) (*mem = val) #define apr_atomic_read(mem) (*mem) #define apr_atomic_init(pool) APR_SUCCESS #define apr_atomic_cas(mem,with,cmp) atomic_cmpxchg((unsigned long *)(mem),(unsigned long)(cmp),(unsigned long)(with)) -#define apr_atomic_casptr(mem,with,cmp) (void*)atomic_cmpxchg((unsigned long *)(mem),(unsigned long)(cmp),(unsigned long)(with)) + +int apr_atomic_dec(apr_atomic_t *mem); +void *apr_atomic_casptr(void **mem, void *with, const void *cmp); +#define APR_OVERRIDE_ATOMIC_DEC 1 +#define APR_OVERRIDE_ATOMIC_CASPTR 1 + +inline int apr_atomic_dec(apr_atomic_t *mem) +{ + atomic_dec(mem); + return *mem; +} + +inline void *apr_atomic_casptr(void **mem, void *with, const void *cmp) +{ + return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); +} #elif defined(__FreeBSD__) |