You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This threadpool implementation is much faster, and much feature rich than other notable threadpool implementations found in GitHub. This threadpool has a very small footprint, and can be extensible upto hundreds of threads.
Features :
Small initialization cost. When the functionmt_create_pool returns, it is also guaranteed that all threads are fully initialized and in waiting state.
Add hundreds of jobs, asynchronously. The functionmt_add_job is implemented to guarantee consistency and fast response.
Dynamically add and/or remove threads at runtime. You can add as many threads as you want usingmt_add_thread function, or remove a thread usingmt_remove_thread function, AT RUNTIME. Just remember, for these functions to work properly, the worker function needs to be as atomic as possible. No threads will be removed if all threads are presently busy. Also, to feel the effect of the new thread, there must be some work to be done.
Easy suspend and resume. You can suspend the pool anytime usingmt_suspend, and resume where you left off usingmt_resume.
Flexible stopping. You can stop the pool in two ways : a) Stop recieving new jobs, but continue existing jobs and then exit and b) Stop recieving new jobs, and exit as immediately as possible. Remeber, for the latter function to work, the work needs to be atomic. No threads will be force stopped if it is currently executing a function.
Proposed additions :
Implement force-stop [Low priority]
You tell me
This API is also fully leak free, tested extensively using valgrind
License and permissions :
It is a GPL'd project. Use it anyhow, anywhere. Just mention this original repo and me as the original author of the project.
About
A fast, small, efficient pthreads based threadpool in c