📄 cetc_heap.h
字号:
/**
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -