Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action_tailrecurser condition explanation #584

Open
ignus2 opened this issue May 9, 2022 · 0 comments
Open

action_tailrecurser condition explanation #584

ignus2 opened this issue May 9, 2022 · 0 comments

Comments

@ignus2
Copy link

ignus2 commented May 9, 2022

Hi,
We're using rxcpp to send messages between components in our app, and we are running into some issues with the recursion, and nailed down our problems to action_tailrecurser, where we couldn't figure out the logic behind it.
Specifically action_tailrecurser::operator()

    inline void operator()(const schedulable& s, const recurse& r) {
        if (!f) {
            std::terminate();
        }
        trace_activity().action_enter(s);
        auto scope = s.set_recursed(r);
        while (s.is_subscribed()) {
            r.reset();
            f(s);
            if (!r.is_allowed() || !r.is_requested()) {
                if (r.is_requested()) {
                    s.schedule();
                }
                break;
            }
            trace_activity().action_recurse(s);
        }
        trace_activity().action_return(s);
    }

We can't really understand this condition:

            if (!r.is_allowed() || !r.is_requested()) {
                if (r.is_requested()) {
                    s.schedule();
                }
                break;
            }

What is this trying to do? Can someone explain it in plain english please? :)
Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant