XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
object.h
浏览该文件的文档.
1
13#ifndef __xwos_lib_object_h__
14#define __xwos_lib_object_h__
15
16#include <xwos/standard.h>
17#include <xwos/lib/xwaop.h>
18#include <xwos/mm/common.h>
19
33#define xwos_cast(type, obj) ((type)(obj))
34
35#define XWOS_OBJ_MAGIC 0x58574F53U
37struct xwos_object;
38
42typedef xwer_t (* xwobj_gc_f)(struct xwos_object *);
43
52// cppcheck-suppress [misra-c2012-2.7, misra-c2012-5.5, misra-c2012-8.2]
53struct __xwcc_aligned(XWMM_ALIGNMENT) xwos_object {
58};
59
63typedef struct {
64 struct xwos_object * obj;
66} xwobj_d;
67
71#define XWOBJ_NILD ((xwobj_d){NULL, 0,})
72
73void xwos_objtik_init(void);
74void xwos_object_construct(struct xwos_object * obj);
75void xwos_object_destruct(struct xwos_object * obj);
77void xwos_object_setgc(struct xwos_object * obj, xwobj_gc_f gcfunc);
84
89#endif /* xwos/lib/object.h */
signed long xwer_t
Definition type.h:554
__xwcc_atomic xwsq_t atomic_xwsq_t
Definition type.h:448
unsigned long xwsq_t
Definition type.h:445
void xwos_object_setgc(struct xwos_object *obj, xwobj_gc_f gcfunc)
设置XWOS对象的垃圾回收函数
Definition object.c:156
xwer_t xwos_object_rawput(struct xwos_object *obj)
减少对象的引用计数,不触发垃圾回收函数
Definition object.c:344
xwer_t(* xwobj_gc_f)(struct xwos_object *)
垃圾回收函数指针类型
Definition object.h:42
xwer_t xwos_object_grab(struct xwos_object *obj)
增加对象的引用计数
Definition object.c:297
xwer_t xwos_object_activate(struct xwos_object *obj, xwobj_gc_f gcfunc)
激活一个XWOS对象(将其引用计数初始化位1)
Definition object.c:135
void xwos_object_construct(struct xwos_object *obj)
XWOS对象的构造函数
Definition object.c:107
xwsq_t xwos_object_get_refcnt(struct xwos_object *obj)
获取XWOS对象的引用计数
Definition object.c:363
void xwos_object_destruct(struct xwos_object *obj)
XWOS对象的析构函数
Definition object.c:119
xwer_t xwos_object_release(struct xwos_object *obj, xwsq_t tik)
检查对象的标签并减少引用计数
Definition object.c:265
void xwos_objtik_init(void)
初始化对象标签分配器
Definition object.c:46
xwer_t xwos_object_acquire(struct xwos_object *obj, xwsq_t tik)
检查对象的标签并增加引用计数
Definition object.c:206
xwer_t xwos_object_put(struct xwos_object *obj)
减少对象的引用计数
Definition object.c:316
XWOS对象描述符
Definition object.h:63
struct xwos_object * obj
Definition object.h:64
xwsq_t tik
Definition object.h:65
XWOS对象
Definition object.h:53
atomic_xwsq_t refcnt
Definition object.h:56
xwsq_t magic
Definition object.h:55
xwsq_t tik
Definition object.h:54
xwobj_gc_f gcfunc
Definition object.h:57
XWOS通用库:原子操作
XWOS内存管理:通用定义
XWOS的标准头文件