cetc_heap.h

来自「linux 数据结构堆栈操作。。 。。 。。 。」· C头文件 代码 · 共 75 行

H
75
字号
/**
 * Copyright (c) 2008, USEE 
 * All rights reserved.
 *
 * filename: cetc_heap.h
 * abstract: about private heap header;
 *			 
 *
 * current version: 1.0
 * authors: bolidehi
 * date: 2008-8-27
 *
 * history version
 * version: 
 * authors: 
 * date: 
 */
#ifndef _CETC_HEAP_H_
#define _CETC_HEAP_H_

#include <pthread.h>
#include "cetc_slist.h"
/**
 * structure heap
 */
typedef struct _tagPrivHeap tagPrivHeap;
struct _tagPrivHeap
{
	int				block_num;
	size_t			block_size;
	void			*data;
	tagSList		list;
	pthread_mutex_t lock;
};

#ifdef _cplusplus
extern "C" {
#endif
/**
 * func : initilaze the privivate heap;
 * @head : private heap;
 * @block_num : block total;
 * @block_size : block size;
 * $return : if success return 0 else return non zero
 */
int cetc_init_privheap(tagPrivHeap *heap, int block_num, size_t block_size);

/**
 * func : destroy the privivate heap;
 * @head : private heap;
 * @block_num : block total;
 * @block_size : block size;
 */
void cetc_destroy_privheap(tagPrivHeap *heap);

/**
 * func : allcoate memery from the privivate heap;
 * @head : private heap;
 * $return : return from private heap block;
 */
void * cetc_alloc_from_privheap(tagPrivHeap *heap);

/**
 * funct : free block data to private heap;
 * @head : private heap;
 * @data : that allocate form private heap;
 */
void cetc_free_to_privheap(tagPrivHeap *heap , void *data);

#ifdef _cplusplus
}
#endif

#endif 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?