diff options
Diffstat (limited to 'src/pulsecore/atomic.h')
-rw-r--r-- | src/pulsecore/atomic.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pulsecore/atomic.h b/src/pulsecore/atomic.h index ad3dca30..a91c4d56 100644 --- a/src/pulsecore/atomic.h +++ b/src/pulsecore/atomic.h @@ -1,12 +1,11 @@ #ifndef foopulseatomichfoo #define foopulseatomichfoo -/* $Id$ */ - /*** This file is part of PulseAudio. - Copyright 2006 Lennart Poettering + Copyright 2006-2008 Lennart Poettering + Copyright 2008 Nokia Corporation PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -380,9 +379,9 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { /* Returns non-zero when the operation was successful. */ static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { - int failed = 1; + pa_bool_t failed; do { - failed = __kernel_cmpxchg(old_i, new_i, &a->value); + failed = !!__kernel_cmpxchg(old_i, new_i, &a->value); } while(failed && a->value == old_i); return !failed; } @@ -404,10 +403,10 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { } static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { - int failed = 1; + pa_bool_t failed; do { - failed = __kernel_cmpxchg_u((unsigned long) old_p, (unsigned long) new_p, &a->value); - } while(failed && a->value == old_p); + failed = !!__kernel_cmpxchg_u((unsigned long) old_p, (unsigned long) new_p, &a->value); + } while(failed && a->value == (unsigned long) old_p); return !failed; } |