diff options
author | Jeff Trawick <trawick@apache.org> | 2003-12-04 20:06:03 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2003-12-04 20:06:03 +0000 |
commit | 5242d89a2e02eef5ce58a83efa411d15126e6613 (patch) | |
tree | d37fbaf861b7975ed041d57b63bb7fe57246105d /atomic/win32 | |
parent | bcc7f9827c769f74131219696e4049e40c29a5fd (diff) | |
download | apr-5242d89a2e02eef5ce58a83efa411d15126e6613.tar.gz |
apr_atomic_add32() and apr_atomic_inc32() now return values (the old value)
Submitted by: gregames (all the hard bits) and trawick
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64808 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic/win32')
-rw-r--r-- | atomic/win32/apr_atomic.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/atomic/win32/apr_atomic.c b/atomic/win32/apr_atomic.c index 624b46a65..801f38cb3 100644 --- a/atomic/win32/apr_atomic.c +++ b/atomic/win32/apr_atomic.c @@ -79,9 +79,9 @@ typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) (apr_uint32_t volatile *, apr_uint32_t, apr_uint32_t); -APR_DECLARE(void) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) { - ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); + return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); } APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) @@ -89,9 +89,10 @@ APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val); } -APR_DECLARE(void) apr_atomic_inc32(volatile apr_uint32_t *mem) +APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) { - ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem); + /* we return old value, win32 returns new value :( */ + return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1; } APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) |