GithubHelp home page GithubHelp logo

Comments (2)

ericniebler avatar ericniebler commented on April 27, 2024

Yes, we need more simple examples, and a simple scheduler example would be very enlightening.

You're not far off here. One mistake you're making is that you're calling the receiver methods more than once. Exactly one receiver method (set_value, set_error, set_done) must be called exactly once. (set_done should only be called when the work has been cancelled, which isn't the case here.)

Better would be to use an algorithm repeat_effect_with_blocking_delay to repeatedly connect the sender returned from schedule multiple times with a sleep between them. You could implement it in terms of repeat_effect_until. (To get an idea, take a look at how repeat_effect is implemented in terms of repeat_effect_until and a forever predicate.)

And if you really want a scheduler with this behavior baked in, you can have your schedule() function return a result of calling repeat_effect_with_blocking_delay.

from libunifex.

tinkerbeast avatar tinkerbeast commented on April 27, 2024

Thanks for your response. I am looking into the repeat_effect_until code. In the meantime I had a look at the io_epoll code. What I can gather from the epoll code is that the data is read only when async_read_some is called. This seems to be pulling data from the read_sender, rather that read_sender pushing data (as would happen in normal socket programming / callbacks). Is the generalized concept of unifex pull rather than push? The one receiver method rule you mentioned would also make more sense in the pull context. Or is there a push paradigm also?

from libunifex.

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.