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

Concurrent rAF loops are not deterministic #9834

Closed
paulrouget opened this issue Mar 2, 2016 · 3 comments
Closed

Concurrent rAF loops are not deterministic #9834

paulrouget opened this issue Mar 2, 2016 · 3 comments
Assignees

Comments

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Mar 2, 2016

<script>
  var i = 0;

  var loopA = t => {
    console.log("A: " + t);

    if (i++ < 5) {
      requestAnimationFrame(loopA);
    }
  };

  var loopB = t => {
    console.log("B: " + t);    
    if (i < 5) {
      requestAnimationFrame(loopB);
    }
  };

  loopA();
  loopB();
</script>

Chrome and Firefox:

====
A
B
A
B
A
B
A
B
A
B
A

Servo:

====
A
B
B
A
B
A
A
B
A
B
A
@nox
Copy link
Member

@nox nox commented Mar 2, 2016

We use a HashMap, that doesn't preserve order. I'm switching it to a BTreeMap.

@nox nox self-assigned this Mar 2, 2016
@nox
Copy link
Member

@nox nox commented Mar 2, 2016

@paulrouget Do you think we have intermittent failures due to this?

nox added a commit to nox/servo that referenced this issue Mar 2, 2016
bors-servo added a commit that referenced this issue Mar 2, 2016
Use a BTreeMap for Document::animation_frame_list (fixes #9834)

The callbacks must stay ordered.
nox added a commit to nox/servo that referenced this issue Mar 2, 2016
nox added a commit to nox/servo that referenced this issue Mar 2, 2016
bors-servo added a commit that referenced this issue Mar 2, 2016
Use a BTreeMap for Document::animation_frame_list (fixes #9834)

The callbacks must stay ordered.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9837)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Mar 2, 2016
Use a BTreeMap for Document::animation_frame_list (fixes #9834)

The callbacks must stay ordered.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9837)
<!-- Reviewable:end -->
@bors-servo bors-servo closed this in 1d87f61 Mar 2, 2016
@paulrouget
Copy link
Contributor Author

@paulrouget paulrouget commented Mar 2, 2016

Do you think we have intermittent failures due to this?

I don't know, but it was causing some weird issues in browserhtml.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.