Comments (2)
Hi @renzibei and thanks for the suggestion! :)
One of the main design philosophies behind this thread pool library is that it should be as light, portable, and self-contained as possible. I want it to be just one header file that will work on any platform that has a C++17-compliant compiler. Therefore, I limit myself to using only standard C++17, with no external dependencies such as Boost. I am aware that a lock-free queue could improve the performance of this library, but I don't want that to be at the cost of the lightness and portability of the library.
I'm working on a version that uses condition variables instead of sleep, and planing a C++20 version that will use semaphores, both of which should improve the performance. I will also take a look at how Boost implements the lock-free queue and see if I can perhaps implement something similar in my library. All of this will probably take at least a month or two though since I'm really busy these days with teaching and grant applications.
from thread-pool.
Update: v3.0.0, to be released in the next few days, will modify the thread pool to use std::condition_variable
, which substantially improves performance. Looking into lock-free queues is still on my TODO list for a future release.
from thread-pool.
Related Issues (20)
- [REQ] worker keeps its task alive for longer than required HOT 1
- [BUG] shared_ptr is not being copied in parallelize_loop HOT 6
- [REQ] Getting thread ids HOT 3
- Performance very slow HOT 1
- Task Priority HOT 4
- [REQ] Balanced workload for push_loop HOT 1
- [REQ] Document unexpected cleanup of tasks in worker HOT 1
- [BUG ?] multiple definitions get_index, get_pool link fails with VS 2022 HOT 4
- Support Task Prepending (executing higher priority tasks first) HOT 1
- Place private classes at head of file HOT 2
- Error linking with version 4.0.0 HOT 1
- [REQ] Q? HOT 1
- [REQ] Allow compiling with exceptions disabled. HOT 8
- [REQ] Can the threads in a pool be pinned to specific cores? HOT 1
- [REQ] ability to set threads to 0, and have everything execute serially HOT 3
- [REQ] does this library support recursive/nested tasks? HOT 5
- [REQ] Explain destructor behavior for thread_pool HOT 4
- [REQ] Add compiler flag/define to make threadpool use a stack instead of queue HOT 3
- Get rid of shared pointer for submitted tasks promises HOT 1
- [REQ] Wait on any task in multi_future and thread_pool HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thread-pool.