34 Star 48 Fork 15

炕头哥 / Ppool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ppool_queue.h 932 Bytes
一键复制 编辑 原始数据 按行查看 历史
炕头哥 提交于 2015-03-05 11:17 . 更新错误处理
#ifndef _PPOOL_QUEUE_H
#define _PPOOL_QUEUE_H
#include "ppool_errno.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
typedef void (*ppool_work)(void *);
typedef struct ppool_node
{
int priority; //优先级
ppool_work task; //任务
void *arg; //参数
struct ppool_node *next;
}pool_node;
//任务列表头指针
typedef struct
{
int len; //任务数量
pool_node *head; //列表头指针
}pool_w;
pool_w *ppool_queue_init(void);
//初始化一个任务列表
pool_node *ppool_queue_new(ppool_work task,void *arg,int priority);
/* 创建一个节点
* task为新任务
* arg为任务参数
* priority为该任务优先级
*/
void ppool_queue_add(pool_w *head,pool_node *node);
// 添加一个任务
pool_node *ppool_queue_get_task(pool_w *head);
//获取一个任务
void ppool_queue_cleanup(pool_w *head);
//清理任务列表
void ppool_queue_destroy(pool_w *head);
//销毁任务列表
#endif
C
1
https://gitee.com/brisk/Ppool.git
git@gitee.com:brisk/Ppool.git
brisk
Ppool
Ppool
master

搜索帮助