发生
来源:互联网 发布:二元期权编程自动交易 编辑:程序博客网 时间:2024/04/29 02:28
/*************************************************************************
> File Name: tpool.h
> Author:
> Mail:
> Created Time: 2015年04月01日 星期三 17时34分00秒
************************************************************************/
#ifndef THREAD_POOL_H__
#define THREAD_POOL_H__
#include <pthread.h>
/* 要执行的任务链表 */
typedef struct tpool_work {
void* (*routine)(int); /* 任务函数 */
int arg; /* 传入任务函数的参数 */
struct tpool_work *next;
}tpool_work_t;
typedef struct tpool {
int shutdown; /* 线程池是否销毁 */
int max_thr_num; /* 最大线程数 */
pthread_t *thr_id; /* 线程ID数组 */
tpool_work_t *queue_head; /* 线程链表 */
pthread_mutex_t queue_lock;
pthread_cond_t queue_ready;
}tpool_t;
/*
* @brief 创建线程池
* @param max_thr_num 最大线程数
* @return 0: 成功 其他: 失败
*/
int
tpool_create(int max_thr_num);
/*
* @brief 销毁线程池
*/
void
tpool_destroy();
/*
* @brief 向线程池中添加任务
* @param routine 任务函数指针
* @param arg 任务函数参数
* @return 0: 成功 其他:失败
*/
int
tpool_add_work(void*(*routine)(int), int arg);
#endif
/*************************************************************************> File Name: tpool.h> Author: > Mail: > Created Time: 2015年04月01日 星期三 17时34分00秒************************************************************************/#ifndef THREAD_POOL_H__#define THREAD_POOL_H__#include <pthread.h>/* 要执行的任务链表 */typedef struct tpool_work {void* (*routine)(int); /* 任务函数 */int arg; /* 传入任务函数的参数 */struct tpool_work *next; }tpool_work_t;typedef struct tpool {int shutdown; /* 线程池是否销毁 */int max_thr_num; /* 最大线程数 */pthread_t *thr_id; /* 线程ID数组 */tpool_work_t *queue_head; /* 线程链表 */pthread_mutex_t queue_lock; pthread_cond_t queue_ready; }tpool_t;/** @brief 创建线程池 * @param max_thr_num 最大线程数* @return 0: 成功 其他: 失败 */inttpool_create(int max_thr_num);/** @brief 销毁线程池 */voidtpool_destroy();/** @brief 向线程池中添加任务* @param routine 任务函数指针* @param arg 任务函数参数* @return 0: 成功 其他:失败 */inttpool_add_work(void*(*routine)(int), int arg);#endif
/*************************************************************************> File Name: tpool.h> Author: > Mail: > Created Time: 2015年04月01日 星期三 17时34分00秒************************************************************************/#ifndef THREAD_POOL_H__#define THREAD_POOL_H__#include <pthread.h>/* 要执行的任务链表 */typedef struct tpool_work {void* (*routine)(int); /* 任务函数 */int arg; /* 传入任务函数的参数 */struct tpool_work *next; }tpool_work_t;typedef struct tpool {int shutdown; /* 线程池是否销毁 */int max_thr_num; /* 最大线程数 */pthread_t *thr_id; /* 线程ID数组 */tpool_work_t *queue_head; /* 线程链表 */pthread_mutex_t queue_lock; pthread_cond_t queue_ready; }tpool_t;/** @brief 创建线程池 * @param max_thr_num 最大线程数* @return 0: 成功 其他: 失败 */inttpool_create(int max_thr_num);/** @brief 销毁线程池 */voidtpool_destroy();/** @brief 向线程池中添加任务* @param routine 任务函数指针* @param arg 任务函数参数* @return 0: 成功 其他:失败 */inttpool_add_work(void*(*routine)(int), int arg);#endif
- 发生
- 发生
- 发生
- 发生发生
- 发生发生
- 发生的方式发生
- 撒发生的发生
- 发生大发生大
- 是的发生的发生打发生
- 阿斯顿发生的发生的发生的
- 阿斯顿发生的发生的发生的
- 发生的发生的发生地方
- 发生噶
- 撒发生
- 飞洒发生
- 随机数发生
- 发生的
- 发生大幅
- iOS字符串去除空格换行
- eclipse安装插件是报错 Failed to prepare partial IU: [R]
- 百度编辑器使用 嵌入ci (可灵活运用,建立数据库,写入并读出,实现用户自定义网页页面内容)
- memcached 完整安装记录
- 实验5——类和对象
- 发生
- android:TableLayout表格布局详解
- C++ && makefile
- 10分钟掌握XML、JSON及其解析
- iTunes Connect新应用发布详细流程(配图)
- OpenGL加载shader代码
- 【计算机网络系列(四)】TCP 与 UDP 详解
- leetcode 日经贴,Cpp code -Flatten Binary Tree to Linked List
- 邮件、社交营销最全“勾搭”策略