Skip to content

Commit

Permalink
Switch from poll_events to wait_events.
Browse files Browse the repository at this point in the history
This fixes 100% CPU usage during idle.
  • Loading branch information
metajack committed Mar 19, 2015
1 parent 3495041 commit f02c550
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ports/glutin/Cargo.toml
Expand Up @@ -28,6 +28,7 @@ path = "../../components/util"

[dependencies.glutin]
git = "https://github.com/servo/glutin"
branch = "servo"

[dependencies.gleam]
git = "https://github.com/servo/gleam"
Expand Down
12 changes: 2 additions & 10 deletions ports/glutin/window.rs
Expand Up @@ -271,16 +271,8 @@ impl Window {
}
}
} else {
// GWTODO: Something has changed in the wait_events
// behaviour in glutin. Switching to poll events
// for now, so that things display correctly,
// need to fix glutin / handle the changed behaviour.
for event in self.window.poll_events() {
close_event = self.handle_window_event(event);
if close_event {
break;
}
}
let event = self.window.wait_events().next().unwrap();
close_event = self.handle_window_event(event);
}

if close_event || self.window.is_closed() {
Expand Down

5 comments on commit f02c550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

saw approval from pcwalton
at metajack@f02c550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

merging metajack/servo/fix-idle-loop = f02c550 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

metajack/servo/fix-idle-loop = f02c550 merged ok, testing candidate = e845695

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

fast-forwarding master to auto = e845695

Please sign in to comment.