Skip to content

Blika/ThreadPool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThreadPool

A simple realization of thread pool in C++.

Usage

You don't need to build this project to use it in your code. Instead just grab related files and use them directly.

Thread pool creates all threads automatically upon initialization.
To assign a new task to some thread, you need to provide the function you need to be done on a separate thread and its weight.
threadPool.assignNewTask(someFunc, 5)
Weight should define how much resources this function will probably use. Complex tasks should be given a higher value of weight.
Pool picks the least busy thread (based on weight of its jobs) for your task, so weight is crucial.
If you want to pass function with infinite loop you should set negative weight, thus thread pool wouldn't assign any more jobs to this thread.

About

Simple Thread Pool for C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published