mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04: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
|
||||
#define foopulserefcntfoo
|
||||
#ifndef foopulserefcnthfoo
|
||||
#define foopulserefcnthfoo
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
|
@ -22,20 +22,21 @@
|
|||
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) \
|
||||
AO_store_release_write(&(p)->_ref, 1)
|
||||
pa_atomic_store(&p->_ref, 1)
|
||||
|
||||
#define PA_REFCNT_INC(p) \
|
||||
AO_fetch_and_add1_release_write(&(p)->_ref)
|
||||
pa_atomic_inc(&p->_ref)
|
||||
|
||||
#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) \
|
||||
AO_load_acquire_read(&(p)->_ref)
|
||||
pa_atomic_load(&p->_ref)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue