VSF Documented
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
source
shell
sys
linux
include
linux
refcount.h
Go to the documentation of this file.
1
#ifndef __VSF_LINUX_REFCOUNT_H__
2
#define __VSF_LINUX_REFCOUNT_H__
3
4
#include <
linux/types.h
>
5
#include <
linux/atomic.h
>
6
7
#ifdef __cplusplus
8
extern
"C"
{
9
#endif
10
11
typedef
struct
refcount_struct
{
12
atomic_t
refs
;
13
}
refcount_t
;
14
15
#define REFCOUNT_INIT(__VALUE) { .refs = ATOMIC_INIT(__VALUE) }
16
17
static
inline
unsigned
int
refcount_read(
refcount_t
*r)
18
{
19
return
atomic_read
(&r->
refs
);
20
}
21
22
static
inline
void
refcount_set(
refcount_t
*r,
int
value
)
23
{
24
atomic_set
(&r->
refs
,
value
);
25
}
26
27
static
inline
void
refcount_inc(
refcount_t
*r)
28
{
29
atomic_inc
(&r->
refs
);
30
}
31
32
static
inline
bool
refcount_dec_and_test(
refcount_t
*r)
33
{
34
return
atomic_dec_and_test
(&r->
refs
);
35
}
36
37
#ifdef __cplusplus
38
}
39
#endif
40
41
#endif
atomic.h
atomic_inc
#define atomic_inc(__v)
Definition
atomic.h:33
atomic_read
#define atomic_read(__v)
Definition
atomic.h:29
atomic_set
#define atomic_set(__v, __i)
Definition
atomic.h:28
atomic_dec_and_test
#define atomic_dec_and_test(__v)
Definition
atomic.h:45
types.h
refcount_t
struct refcount_struct refcount_t
atomic_t
Definition
atomic.h:23
refcount_struct
Definition
refcount.h:11
refcount_struct::refs
atomic_t refs
Definition
refcount.h:12
value
vk_av_control_value_t value
Definition
vsf_audio.h:171
Generated by
1.9.8