Replaced mutex in constellation logging by a reentrant mutex.

This commit is contained in:
Alan Jeffrey 2016-07-27 17:49:34 -05:00
parent 4077ae7d04
commit e3030d053a
6 changed files with 319 additions and 5 deletions

View file

@ -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))
}
}
@ -353,14 +354,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))
}
}