diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-03 22:22:49 -0500 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-06-03 22:22:49 -0500 |
commit | 6581e3504a60aa1e7c363cc93b1036b4a174c166 (patch) | |
tree | e2de576b80de9fcc795b12135d9a693c058cf1eb /components/constellation/pipeline.rs | |
parent | 93fc7c9cc3d581da6efa5d04e889c5003c4e5709 (diff) | |
parent | 2416072dc2b264191ab9a6515a8f9c3415849b71 (diff) | |
download | servo-6581e3504a60aa1e7c363cc93b1036b4a174c166.tar.gz servo-6581e3504a60aa1e7c363cc93b1036b4a174c166.zip |
Auto merge of #11585 - asajeffrey:constellation-avoid-deadlock-during-pipeline-closure, r=larsbergstrom
Avoid deadlock when closing a pipeline.
<!-- Please describe your changes on the following line: -->
At the moment, the constellation blocks on a pipeline during closure. This PR makes pipeline closure asynchronous.
---
<!-- 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` does not report any errors
- [X] These changes fix #11546.
- [X] These changes do not require tests because testing for absence of deadlock is difficult.
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- 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/11585)
<!-- Reviewable:end -->
Diffstat (limited to 'components/constellation/pipeline.rs')
-rw-r--r-- | components/constellation/pipeline.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 3f4abbbbc3e..7718eb76036 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -309,6 +309,8 @@ impl Pipeline { // The compositor wants to know when pipelines shut down too. // It may still have messages to process from these other threads // before they can be safely shut down. + // It's OK for the constellation to block on the compositor, + // since the compositor never blocks on the constellation. if let Ok((sender, receiver)) = ipc::channel() { self.compositor_proxy.send(CompositorMsg::PipelineExited(self.id, sender)); if let Err(e) = receiver.recv() { @@ -318,13 +320,8 @@ impl Pipeline { // Script thread handles shutting down layout, and layout handles shutting down the painter. // For now, if the script thread has failed, we give up on clean shutdown. - if self.script_chan - .send(ConstellationControlMsg::ExitPipeline(self.id)) - .is_ok() { - // Wait until all slave threads have terminated and run destructors - // NOTE: We don't wait for script thread as we don't always own it - let _ = self.paint_shutdown_port.recv(); - let _ = self.layout_shutdown_port.recv(); + if let Err(e) = self.script_chan.send(ConstellationControlMsg::ExitPipeline(self.id)) { + warn!("Sending script exit message failed ({}).", e); } } |