Comments (8)
Hi @mokafolio and thanks for opening this issue! My design philosophy starting with v4.0.0 has been to implement certain features as optional and let the user decide. I believe your request should be trivial to implement by changing exception handling to an optional feature, and adding a macro (e.g. BS_THREAD_POOL_ENABLE_EXCEPTION_HANDLING
) to enable them manually for users who need them. I will incorporate that into the next release (could be either v4.0.2 or v4.1.0 depending how many changes I make by then).
from thread-pool.
Sure, that makes sense. I'll also have to change it so that BS_THREAD_POOL_ENABLE_WAIT_DEADLOCK_CHECK
cannot be enabled if exceptions are disabled, or perhaps emits a compiler error/warning. Once I have time to work on a new release I'll look into it.
from thread-pool.
Update: This is now implemented in v4.1.0.
from thread-pool.
__cpp_exceptions
could be used to check if exceptions are enabled or not (https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations)
from thread-pool.
Sounds great! I'd maybe suggest changing the flag to BS_THREAD_POOL_DISABLE_EXCEPTION_HANDLING
as I feel like that should be an opt out rather than opt in kind of functionality :)
from thread-pool.
Hmm... But all the other macros are BS_THREAD_POOL_ENABLE_xxxxx
, and I like to be consistent 😄 Besides, not everyone needs exception handling. In my own projects using this thread pool I never had any situation where I had to catch an exception thrown by a task. And the main reason I like having opt-ins for optional features is that not enabling a feature keeps the library lighter and (potentially) faster.
from thread-pool.
Yeah, on a personal level I am with you and I also like the consistency. I still think most people expect exception handling to be in place by default but it's your call, I certainly can live with either decision 😄
from thread-pool.
I still think the least intrusive solution could be to just rely on whether exceptions are enabled or not via __cpp_exceptions
. That way it will do the right thing based on the build flags. Adding an extra library level flag does not add that much more usefulness imo.
from thread-pool.
Related Issues (20)
- 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] 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
- [BUG] Thread pool is NOT avaliable when it was created. HOT 1
- [BUG] Task is not shared between threads, but instead badly duplicated. HOT 11
- [REQ] Rename Timer into TimeMeasure and providing a real timer class? HOT 1
- [BUG] new Microsoft Visual C++ 2015-2022 Redistributable requires #define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR HOT 3
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.