mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
constellation: join on script-threads (#38424)
We currently send exit signals to script-threads, and we also join on the BHM worker. This ensure the constellation shuts-down only after script has dropped it's sender to the BHM worker. By joining on the script-threads, we have a guarantee that they have exited(which is stronger than having dropped their senders) by the time the constellation exits. Testing: Manually opened many tabs and closed the window, both in single- and multi-process modes. Fixes: Part of - https://github.com/servo/servo/issues/30849 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
b23adab8a5
commit
a99ad240a0
5 changed files with 45 additions and 16 deletions
|
@ -25,7 +25,7 @@ use std::rc::Rc;
|
|||
use std::result::Result;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::thread;
|
||||
use std::thread::{self, JoinHandle};
|
||||
use std::time::{Duration, Instant, SystemTime};
|
||||
|
||||
use background_hang_monitor_api::{
|
||||
|
@ -412,7 +412,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
layout_factory: Arc<dyn LayoutFactory>,
|
||||
system_font_service: Arc<SystemFontServiceProxy>,
|
||||
load_data: LoadData,
|
||||
) {
|
||||
) -> JoinHandle<()> {
|
||||
thread::Builder::new()
|
||||
.name(format!("Script{:?}", state.id))
|
||||
.spawn(move || {
|
||||
|
@ -462,7 +462,7 @@ impl ScriptThreadFactory for ScriptThread {
|
|||
// This must always be the very last operation performed before the thread completes
|
||||
failsafe.neuter();
|
||||
})
|
||||
.expect("Thread spawning failed");
|
||||
.expect("Thread spawning failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue