小编tic*_*man的帖子

查询简单的C++线程池实现

Stackoverflow对我来说是一个巨大的帮助,我会回馈社区.我一直在使用TinyThread ++ 网站 C++可移植线程库实现一个简单的线程池,使用我从Stackoverflow中学到的东西.我是线程编程的新手,所以对互斥体等不太熟悉.我在提交代码后问了最好的问题(在Linux下运行得很好):

// ThreadPool.h

class ThreadPool
{
 public:

 ThreadPool();
~ThreadPool();

// Creates a pool of threads and gets them ready to be used
void CreateThreads(int numOfThreads);

// Assigns a job to a thread in the pool, but doesn't start the job
// Each SubmitJob call will use up one thread of the pool.
// This operation can only be undone by calling StartJobs and
// then waiting for the jobs to complete. On completion,
// new jobs may …
Run Code Online (Sandbox Code Playgroud)

c++ implementation threadpool

6
推荐指数
1
解决办法
3355
查看次数

标签 统计

c++ ×1

implementation ×1

threadpool ×1