Git Product home page Git Product logo

Comments (4)

ahicks92 avatar ahicks92 commented on June 11, 2024

Maybe an implicit threadpool stored in TLS, then primitives that access it?

Passing a threadpool around would get cumbersome if you had to funnel it through all the futures. You could store it with any number of things, but a simple "go do this closure over there" seems useful to me. Are there many cases in which you would want more threads than CPUs? Because if not, the thread pool could also implicitly construct itself.

from futures-rs.

alexcrichton avatar alexcrichton commented on June 11, 2024

There's a little bit of this being fleshed out in #95, but I think in general this is going to require some form of threading around a CpuPool to spawn work on if you want to spawn work onto a thread pool.

from futures-rs.

bluetech avatar bluetech commented on June 11, 2024

OK, if you don't think there's a use-case for a trait, I will just have the user pass in a CpuPool in my library for now. I will save you a lecture about the dependency inversion principle :)

from futures-rs.

alexcrichton avatar alexcrichton commented on June 11, 2024

@bluetech oh I'm not saying that there's no use for this, I just wanted to give an update to the current state of affairs. We may end up needing a more official trait after all, but it may also be best to flesh out a bit first and see if it comes up.

from futures-rs.

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.