mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #12637 - asajeffrey:constellation-use-reentrant-logging-mutex, r=emilio
Replaced mutex in constellation logging by a reentrant mutex. <!-- Please describe your changes on the following line: --> The double-panic in #12553 may be caused by using a non-reentrant lock, which panics on reetry. This PR adds a reentrant lock type (slightly annoyingly, the implementation in std isn't exported) and uses it for logging. cc @jdm --- <!-- 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 #12619. - [X] These changes do not require tests because they are designed to remove a class of intermittents. <!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12637) <!-- Reviewable:end -->
This commit is contained in:
commit
fdb1e511bd
6 changed files with 319 additions and 5 deletions
|
@ -54,8 +54,8 @@ use std::iter::once;
|
|||
use std::marker::PhantomData;
|
||||
use std::mem::replace;
|
||||
use std::process;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{Sender, channel, Receiver};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
use style_traits::PagePx;
|
||||
|
@ -65,6 +65,7 @@ use timer_scheduler::TimerScheduler;
|
|||
use url::Url;
|
||||
use util::opts;
|
||||
use util::prefs::PREFS;
|
||||
use util::remutex::ReentrantMutex;
|
||||
use util::thread::spawn_named;
|
||||
use webrender_traits;
|
||||
|
||||
|
@ -314,14 +315,14 @@ enum ExitPipelineMode {
|
|||
#[derive(Clone)]
|
||||
pub struct FromScriptLogger {
|
||||
/// A channel to the constellation
|
||||
pub constellation_chan: Arc<Mutex<IpcSender<FromScriptMsg>>>,
|
||||
pub constellation_chan: Arc<ReentrantMutex<IpcSender<FromScriptMsg>>>,
|
||||
}
|
||||
|
||||
impl FromScriptLogger {
|
||||
/// Create a new constellation logger.
|
||||
pub fn new(constellation_chan: IpcSender<FromScriptMsg>) -> FromScriptLogger {
|
||||
FromScriptLogger {
|
||||
constellation_chan: Arc::new(Mutex::new(constellation_chan))
|
||||
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,14 +353,14 @@ impl Log for FromScriptLogger {
|
|||
#[derive(Clone)]
|
||||
pub struct FromCompositorLogger {
|
||||
/// A channel to the constellation
|
||||
pub constellation_chan: Arc<Mutex<Sender<FromCompositorMsg>>>,
|
||||
pub constellation_chan: Arc<ReentrantMutex<Sender<FromCompositorMsg>>>,
|
||||
}
|
||||
|
||||
impl FromCompositorLogger {
|
||||
/// Create a new constellation logger.
|
||||
pub fn new(constellation_chan: Sender<FromCompositorMsg>) -> FromCompositorLogger {
|
||||
FromCompositorLogger {
|
||||
constellation_chan: Arc::new(Mutex::new(constellation_chan))
|
||||
constellation_chan: Arc::new(ReentrantMutex::new(constellation_chan))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue