Giter VIP home page Giter VIP logo

Comments (2)

kirkshoop avatar kirkshoop commented on May 12, 2024 2

Yes, cross-thread cancellation is always a race. In the Rx model this is type of race is safe.

Only one call to on_error/on_completed/unsubscribe is delivered no matter how many calls are made. And once one of those calls is made no further calls to on_next will be delivered.

The subscriber uses is_subscribed() to filter calls to on_next/on_error/on_completed and calls unsubscribe when on_error/on_completed have been delivered.

calls to is_subscribed() are used to interrupt loops. unsubscribe functions passed to add() are used to teardown resources and connections. they are both needed to cover the diversity of sources. without is_subscribed() there would be so many unsubscribe functions passed to add() that just set a bool.

from rxcpp.

daixtrose avatar daixtrose commented on May 12, 2024

OK, I see I still have a lot to learn. Nonetheless my first impulse is that I would prefer an interface where this method is missing. If this type of race is safe (I assume s.on_next() will then throw or lead to a noop) why check anyway? And sorry if I do not grok it immediately.

from rxcpp.

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.