Skip to content

senlinzhan/dpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;
}

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy