XWOS API
4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
objcache.h
浏览该文件的文档.
1
13
#ifndef __xwos_mm_mempool_objcache_h__
14
#define __xwos_mm_mempool_objcache_h__
15
16
#include <
xwos/standard.h
>
17
#include <
xwos/lib/xwbop.h
>
18
#include <
xwos/lib/bclst.h
>
19
#include <
xwos/osal/lock/seqlock.h
>
20
#include <
xwos/mm/common.h
>
21
28
#include <
xwos/mm/mempool/i_allocator.h
>
29
#include <
xwos/mm/mempool/page.h
>
30
34
struct
xwmm_mempool_objcache
{
35
struct
xwmm_mempool_i_allocator
i_a
;
36
struct
xwmm_mempool_page_allocator
*
pa
;
37
const
char
*
name
;
38
xwsz_t
objsize
;
39
xwsz_t
alignment
;
40
xwsq_t
pg_order
;
41
xwsz_t
pg_objnr
;
42
xwptr_t
backup
;
48
ctor_f
ctor
;
49
dtor_f
dtor
;
50
atomic_xwsz_t
capacity
;
51
atomic_xwsz_t
idleness
;
52
atomic_xwsz_t
reserved
;
54
struct
{
55
struct
xwlib_bclst_head
full;
56
struct
xwlib_bclst_head
available;
57
struct
xwlib_bclst_head
idle;
58
struct
xwos_sqlk
lock;
59
}
page_list
;
60
};
61
76
xwer_t
xwmm_mempool_objcache_init
(
struct
xwmm_mempool_objcache
* oc,
77
struct
xwmm_mempool_page_allocator
* pa,
78
const
char
* name,
79
xwsz_t
objsize,
xwsz_t
alignment,
xwsq_t
pg_order,
80
ctor_f
ctor,
dtor_f
dtor);
81
90
xwer_t
xwmm_mempool_objcache_alloc
(
struct
xwmm_mempool_objcache
* oc,
void
** objbuf);
91
100
xwer_t
xwmm_mempool_objcache_free
(
struct
xwmm_mempool_objcache
* oc,
void
* obj);
101
110
xwer_t
xwmm_mempool_objcache_reserve
(
struct
xwmm_mempool_objcache
* oc,
111
xwsz_t
reserved);
112
120
xwer_t
xwmm_mempool_objcache_get_capacity
(
struct
xwmm_mempool_objcache
* oc,
121
xwsz_t
* capacity);
122
127
#endif
/* xwos/mm/mempool/objcache.h */
bclst.h
XWOS通用库:双循环链表
xwmm_mempool_objcache_init
xwer_t xwmm_mempool_objcache_init(struct xwmm_mempool_objcache *oc, struct xwmm_mempool_page_allocator *pa, const char *name, xwsz_t objsize, xwsz_t alignment, xwsq_t pg_order, ctor_f ctor, dtor_f dtor)
XWMM API:初始化对象缓存
Definition
objcache.c:54
xwmm_mempool_objcache_alloc
xwer_t xwmm_mempool_objcache_alloc(struct xwmm_mempool_objcache *oc, void **objbuf)
XWMM API:从对象缓存中申请一个对象
Definition
objcache.c:263
xwmm_mempool_objcache_reserve
xwer_t xwmm_mempool_objcache_reserve(struct xwmm_mempool_objcache *oc, xwsz_t reserved)
XWMM API:预留对象到对象缓存中
Definition
objcache.c:344
xwmm_mempool_objcache_get_capacity
xwer_t xwmm_mempool_objcache_get_capacity(struct xwmm_mempool_objcache *oc, xwsz_t *capacity)
XWMM API:获取对象缓存的容量
Definition
objcache.c:383
xwmm_mempool_objcache_free
xwer_t xwmm_mempool_objcache_free(struct xwmm_mempool_objcache *oc, void *obj)
XWMM API:释放对象到对象缓存中
Definition
objcache.c:299
xwlib_bclst_head
#define xwlib_bclst_head
双循环链表头
Definition
bclst.h:35
xwer_t
signed long xwer_t
Definition
type.h:554
xwsz_t
unsigned long xwsz_t
Definition
type.h:339
xwsq_t
unsigned long xwsq_t
Definition
type.h:445
xwptr_t
unsigned long xwptr_t
Definition
type.h:375
atomic_xwsz_t
__xwcc_atomic xwsz_t atomic_xwsz_t
Definition
type.h:342
ctor_f
void(* ctor_f)(void *)
Definition
type.h:604
dtor_f
void(* dtor_f)(void *)
Definition
type.h:605
i_allocator.h
XWOS内存管理:内存池:分配器接口
seqlock.h
操作系统抽象层:顺序锁
page.h
XWOS内存管理:内存池:页分配器
xwmm_mempool_i_allocator
interface:分配器
Definition
i_allocator.h:27
xwmm_mempool_objcache
对象缓存
Definition
objcache.h:34
xwmm_mempool_objcache::objsize
xwsz_t objsize
Definition
objcache.h:38
xwmm_mempool_objcache::pa
struct xwmm_mempool_page_allocator * pa
Definition
objcache.h:36
xwmm_mempool_objcache::dtor
dtor_f dtor
Definition
objcache.h:49
xwmm_mempool_objcache::backup
xwptr_t backup
Definition
objcache.h:42
xwmm_mempool_objcache::alignment
xwsz_t alignment
Definition
objcache.h:39
xwmm_mempool_objcache::i_a
struct xwmm_mempool_i_allocator i_a
Definition
objcache.h:35
xwmm_mempool_objcache::pg_objnr
xwsz_t pg_objnr
Definition
objcache.h:41
xwmm_mempool_objcache::reserved
atomic_xwsz_t reserved
Definition
objcache.h:52
xwmm_mempool_objcache::idleness
atomic_xwsz_t idleness
Definition
objcache.h:51
xwmm_mempool_objcache::ctor
ctor_f ctor
Definition
objcache.h:48
xwmm_mempool_objcache::name
const char * name
Definition
objcache.h:37
xwmm_mempool_objcache::pg_order
xwsq_t pg_order
Definition
objcache.h:40
xwmm_mempool_objcache::page_list
struct xwmm_mempool_objcache::@0 page_list
xwmm_mempool_objcache::capacity
atomic_xwsz_t capacity
Definition
objcache.h:50
xwmm_mempool_page_allocator
页分配器
Definition
page.h:83
xwos_sqlk
XWOS API:顺序锁
Definition
seqlock.h:112
xwbop.h
XWOS通用库:位操作
common.h
XWOS内存管理:通用定义
standard.h
XWOS的标准头文件
xwos
mm
mempool
objcache.h
制作者
1.9.7