Code Monkey home page Code Monkey logo

Comments (8)

bshoshany avatar bshoshany commented on June 14, 2024 1

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.

bshoshany avatar bshoshany commented on June 14, 2024 1

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.

bshoshany avatar bshoshany commented on June 14, 2024 1

Update: This is now implemented in v4.1.0.

from thread-pool.

mokafolio avatar mokafolio commented on June 14, 2024

__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.

mokafolio avatar mokafolio commented on June 14, 2024

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.

bshoshany avatar bshoshany commented on June 14, 2024

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.

mokafolio avatar mokafolio commented on June 14, 2024

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.

mokafolio avatar mokafolio commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.