1 Star 0 Fork 25

david / threadpool

forked from niukey / threadpool 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.cpp 577 Bytes
一键复制 编辑 原始数据 按行查看 历史
akzi 提交于 2015-01-22 13:33 . add threadpool files
#include "threadpool_t.h"
#include <iostream>
std::mutex __mutex;
void printf(void *data_)
{
__mutex.lock();
//std::this_thread::sleep_for(std::chrono::seconds(1));
std::cout<<"data:"<<(char*)data_<<std::endl;
__mutex.unlock();
}
int main()
{
char buf[] = "threadpool2";
threadpool_t threadpool;
threadpool.init(100,1);
std::cout<<"threadpool start ..."<<std::endl;
for (uint32_t i = 0 ;i < 100; ++i)
{
task_t task(printf,buf);
threadpool.add_task(task);
}
std::this_thread::sleep_for(std::chrono::seconds(1));
threadpool.destroy();
return 0;
}
C++
1
https://gitee.com/DavildG/threadpool.git
git@gitee.com:DavildG/threadpool.git
DavildG
threadpool
threadpool
master

搜索帮助