第一天
来源:互联网 发布:被芯哪个牌子好 知乎 编辑:程序博客网 时间:2024/05/19 16:48
首先分析cache.c cache.h文件
首先头文件
包含pthread.h,这个与线程有关的头文件
定义一个构造分配的内存的构造函数指针类型,cache_constructor_t
定义一个返回到操作系统之前用于清理分配对象的函数指针类型,cache_destructor_t
typedef struct {
/** Mutex to protect access to the structure */
pthread_mutex_t mutex; 用于保护整个结构体的互斥量
/** Name of the cache objects in this cache (provided by the caller) */
char *name; 缓冲区的对象名字
/** List of pointers to available buffers in this cache */
void **ptr; 指向可用缓冲区中可用的缓存地址
/** The size of each element in this cache */
size_t bufsize; 每个缓冲区中元素大小
/** The capacity of the list of elements */
int freetotal; 一共有多少个缓存
/** The current number of free elements */
int freecurr; 目前多少个没有被使用的缓存
/** The constructor to be called each time we allocate more memory */
cache_constructor_t* constructor; 构造函数
/** The destructor to be called each time before we release memory */
cache_destructor_t* destructor; 析构函数
} cache_t;
cache_create 创建一个缓存对象
cache_destroy 销毁一个缓存对象
cache_alloc 从缓冲区分配一个对象
cache_free 将对象返回到缓冲区
以下是assoc.c文件
定义一个64位的redzone_pattern常量,不知道用来干嘛的。
定义整形常量initial_pool_size 为64
cache_create
- 第一天
- 第一天
- 第一天~
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- #第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- 第一天
- ARM汇编实战3: destory stack issue
- Oracle(四)- Oracle的优化器的RBO和CBO方式
- pinterest反编译(正在进行时)
- vtk 笔记 --- 图片的X与Y轴变换,旋转
- linux fd 系列
- 第一天
- 2013中国软件技术大会 参会笔录及感想
- 【九度】题目1283:第一个只出现一次的字符
- windows环境下的Python HTTP请求模块
- 英语伤痛十五年
- Android 随笔(二) 真机调试
- 新手开淘宝网店怎样一个月安全达到一钻
- 《无人区》—电影随评
- RHEL 6.4(i386)编译安装GoldenDict