SkillAgentSearch skills...

Dpool

使用 C++11 实现的动态线程池

Install / Use

/learn @senlinzhan/Dpool
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

License: MIT Build status

dpool

使用 C++11 实现的动态线程池,主要特性:

  • 使用简单,不易出错。
  • 支持线程复用,提升性能。
  • 支持懒惰创建线程。
  • 必要时自动回收空闲的线程。

快速上手

#include "ThreadPool.hpp"
#include <iostream>

int compute(int a, int b)
{
    return a + b;
}

int main()
{
    // 设置最大线程数为 10
    dpool::ThreadPool pool(10);

    auto fut = pool.submit(compute, 100, 100);
    std::cout << "100 + 100 = " << fut.get() << std::endl;
    
    return 0;
}
View on GitHub
GitHub Stars217
CategoryDevelopment
Updated20d ago
Forks27

Languages

C++

Security Score

95/100

Audited on Mar 11, 2026

No findings