Skip to content

[DO NOT MERGE] constellation: Simplify the scheduler so it doesn't create a thread for each event - #11272

Closed
emilio wants to merge 1 commit into
servo:masterfrom
emilio:scheduler
Closed

emilio wants to merge 1 commit into
servo:masterfrom
emilio:scheduler

Conversation

@emilio

@emilio emilio commented May 19, 2016 •

Copy link
Copy Markdown
Member

Thank you for contributing to Servo! Please replace each [ ] by [X] when the step is complete, and replace __ with appropriate data:

Either:

  • These changes do not require tests because this is a refactoring

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.


This can't land as-is, just wanted to make sure this idea is fine, and do a try
run because I need to leave now.

r? @asajeffrey


This change is Reviewable

…read for each event

This can't land as-is, just wanted to make sure this idea is fine, and do a try
run because I need to leave now.
@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @asajeffrey: components/constellation/timer_scheduler.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label May 19, 2016
@emilio

emilio commented May 19, 2016

Copy link
Copy Markdown
Member Author

Note that this can't land as-is since the recv_with_timeout function is spinning, but wanted to push this as a WIP.

@bors-servo: try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 28f0b09 with merge c19182a...

bors-servo pushed a commit that referenced this pull request May 19, 2016
[DO NOT MERGE] constellation: Simplify the scheduler so it doesn't create a thread for each event

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [x] These changes fix #11268 (github issue number if applicable).

Either:
- [x] These changes do not require tests because this is a refactoring

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

---

This can't land as-is, just wanted to make sure this idea is fine, and do a try
run because I need to leave now.

r? @asajeffrey

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11272)
<!-- Reviewable:end -->
}
}

fn recv_with_timeout<T: Send>(port: &Receiver<T>, from: NsDuration, timeout: NsDuration) -> Option<T> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking from as an argument seems a little odd.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it was to avoid another precise_time_ns call. I'll see how I can refactor it so it's cleaner :)

@emilio

emilio commented May 19, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: try-

return Some(Task::DispatchDueEvents);
}

let timeout = now - event.for_time;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, and should be the inverse, I'll fix it when I'm in front of a computer

@metajack

Copy link
Copy Markdown
Collaborator

This is a huge improvement on readability as well as solving the problem you identified. Great work. How are you planning to fix recv_with_timeout?

@pcwalton will probably want to have a quick look at this.

@nox

nox commented May 19, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r-

Homu is confused.

@nox

nox commented May 19, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r- clean force try-

@nox

nox commented May 19, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r+ clean force

Trying things...

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 28f0b09 has been approved by nox

@highfive highfive assigned nox and unassigned asajeffrey May 19, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels May 19, 2016
@nox

nox commented May 19, 2016

Copy link
Copy Markdown
Contributor

@bors-servo r- force

@nox nox assigned asajeffrey and unassigned nox May 19, 2016
@nox

nox commented May 19, 2016

Copy link
Copy Markdown
Contributor

Closing this, Homu broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid creating a thread every single event we receive

6 participants