Skip to content

线程数量可根据任务数量动态增加或动态回收,设计既能满足高响应,又能节省线程资源。支持任意函数或参数的传递

License

Notifications You must be signed in to change notification settings

Yunzhou-LI/ThreadPool-based-on-cpp11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ThreadPool-based-on-cpp11

1.线程数量可根据任务数量动态增加或动态回收,设计既能满足高响应,又能节省线程资源。
2.支持任意类型的函数或任意数量及类型的参数传递。

#example  
void HelloWorld()  
{  
  cout<<"Hello World!"<<endl;  
}  
int sum(int a,int b)  
{  
  return a+b;  
}  
int main()  
{  
  threadpool pool;    
  pool.start(2);  
  pool.submitTask(HelloWorld);  
  future<int> res = pool.submitTask(sum,10,20);  
  cout<<res.get()<<endl;  
  
  return 0;  
}

About

线程数量可根据任务数量动态增加或动态回收,设计既能满足高响应,又能节省线程资源。支持任意函数或参数的传递

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages