GithubHelp home page GithubHelp logo

Comments (3)

Matthias247 avatar Matthias247 commented on June 26, 2024

You are right. The same probably also applies to other Futures. I now recall a discussion on discord (or somewhere else?) where the question was whether Wakers should actually be updated. I think some mentioned "no", but strictly speaking it's the right thing to do. I will push an update.

I am not sure whether you can really move the Future between tasks. It at least has to be pinned, and thereby it is already very restricted what you can do with it. Executors will likely always be passing the same Waker, but it's better not to rely on it.

will_wake() sounds good to avoid the refcount churn - but I just discovered that it's broken due to the executor optimizations: Those sometimes pass a different Waker reference which only on .clone() gets transformed into the real Waker. E.g. futures-rs does it here. That saves the refcount increase and decrease on the executor - but now causes will_wake() to always return false.

from futures-intrusive.

sfackler avatar sfackler commented on June 26, 2024

I am not sure whether you can really move the Future between tasks.

It is possible, but I'm not sure you'd ever really see it in "normal" code. You could for example make a future that contains a Pin<Box<impl Future>>, polls it once and then sends it on a channel to a task running on another executor.

from futures-intrusive.

Matthias247 avatar Matthias247 commented on June 26, 2024

This should be fixed now. I checked all Pending returns and added updates for the Waker.

from futures-intrusive.

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.