mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
upgrade refcnt.h to make use of our new pa_atomic_xxx() API
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1403 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
736de36f68
commit
5ad143b3ab
1 changed files with 9 additions and 8 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef foopulserefcntfoo
|
#ifndef foopulserefcnthfoo
|
||||||
#define foopulserefcntfoo
|
#define foopulserefcnthfoo
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
@ -22,20 +22,21 @@
|
||||||
USA.
|
USA.
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include <atomic_ops.h>
|
#include <pulsecore/atomic.h>
|
||||||
|
|
||||||
#define PA_REFCNT_DECLARE volatile AO_t _ref
|
#define PA_REFCNT_DECLARE \
|
||||||
|
pa_atomic_int_t _ref
|
||||||
|
|
||||||
#define PA_REFCNT_INIT(p) \
|
#define PA_REFCNT_INIT(p) \
|
||||||
AO_store_release_write(&(p)->_ref, 1)
|
pa_atomic_store(&p->_ref, 1)
|
||||||
|
|
||||||
#define PA_REFCNT_INC(p) \
|
#define PA_REFCNT_INC(p) \
|
||||||
AO_fetch_and_add1_release_write(&(p)->_ref)
|
pa_atomic_inc(&p->_ref)
|
||||||
|
|
||||||
#define PA_REFCNT_DEC(p) \
|
#define PA_REFCNT_DEC(p) \
|
||||||
(AO_fetch_and_sub1_release_write(&(p)->_ref)-1)
|
(pa_atomic_dec(&p->_ref)-1)
|
||||||
|
|
||||||
#define PA_REFCNT_VALUE(p) \
|
#define PA_REFCNT_VALUE(p) \
|
||||||
AO_load_acquire_read(&(p)->_ref)
|
pa_atomic_load(&p->_ref)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue