Skip to content

Lin-jingy/Mini-ThreadPool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

ThreadPool

Minimal implementation of a fully functional C++ thread pool

How to use:

#include <iostream>

#include "ThreadPool.hpp"


int main() {
    // create thread pool
    ThreadPool pool;

    // get the number of threads
    std::cout << "thread_number: " << pool.thread_count() << std::endl;

    // get the number of tasks
    std::cout << "task number: " << pool.task_count() << std::endl;

    // submit Task
    auto result = pool.submit([](int a, int b) { return a + b; }, 1, 2);

    // get result from future
    std::cout << result.get() << std::endl;

    return 0;
}

About

Minimal implementation of a fully functional C++ thread pool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages