📄 heap.h
字号:
/* ********************************************************************
** FileName: heap.h
** Description: The header file for heap queue, which is used for soft
** timer in the application
** Author: Jesse Jiang
** Date : July 10,2007
** Versioin: v0.1
**
** Version History:
** ------------------------------------------------------------------
** July 14, 2007 v0.1 Jesse Jiang Initial version
** Nov 26, 2007 v0.2 Jesse Jiang Use struct timeval to replace
** data in the structure T_HEAP_NODE
**
** *********************************************************************/
#ifndef __NSY_HEAP_H_
#define __NSY_HEAP_H_
#undef NSY_WIN
#ifdef NSY_WIN
#include <Winsock2.h>
#else
#include <pthread.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/times.h>
#include <unistd.h>
#endif
#define HEAP_MAX_SIZE (100)
#define HWND_ALL (255)
typedef struct T_Heap_Node
{
unsigned int hwnd;
int id;
struct timeval value;
} T_HEAP_NODE;
typedef struct T_Heap
{
T_HEAP_NODE *heap_node[HEAP_MAX_SIZE];
int size;
int count;
#ifdef NSY_WIN
CRITICAL_SECTION heap_lock;
#else
pthread_mutex_t heap_lock;
#endif
} T_HEAP;
extern int heap_init(T_HEAP *heap, int size);
extern void heap_release(T_HEAP *heap);
extern void heap_empty(T_HEAP *heap);
extern int heap_push(T_HEAP *heap, T_HEAP_NODE *node);
extern T_HEAP_NODE* heap_pop (T_HEAP *heap);
extern T_HEAP_NODE* heap_top (T_HEAP *heap);
extern int heap_remove (T_HEAP *heap, unsigned int hwnd, int id);
extern int heap_count(T_HEAP *heap, unsigned int hwnd);
extern long timeval_compare(struct timeval *fisrt_val, struct timeval *second_val);
extern void timeval_add (struct timeval *value, int val_ms);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -