aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/main.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2024-05-03 22:20:45 +0200
committerGitHub <noreply@github.com>2024-05-03 20:20:45 +0000
commita77f77c48fca298caab3a4834b2d7ab1a98cae88 (patch)
tree308699bf8619487597307d22b699d642f632b80d /alacritty/src/main.rs
parent82f41ed65ce0d3207d56d6877fd0ed898d7dce0c (diff)
downloadalacritty-a77f77c48fca298caab3a4834b2d7ab1a98cae88.tar.gz
alacritty-a77f77c48fca298caab3a4834b2d7ab1a98cae88.zip
Fix shutdown of config monitor
This implements a coordinated shutdown of the config monitor by sending an event to its thread and waiting for the thread to terminate.
Diffstat (limited to 'alacritty/src/main.rs')
-rw-r--r--alacritty/src/main.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index 2a60961a..f9301767 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -56,7 +56,8 @@ mod gl {
#[cfg(unix)]
use crate::cli::MessageOptions;
use crate::cli::{Options, Subcommands};
-use crate::config::{monitor, UiConfig};
+use crate::config::monitor::ConfigMonitor;
+use crate::config::UiConfig;
use crate::event::{Event, Processor};
#[cfg(target_os = "macos")]
use crate::macos::locale;
@@ -165,8 +166,10 @@ fn alacritty(mut options: Options) -> Result<(), Box<dyn Error>> {
//
// The monitor watches the config file for changes and reloads it. Pending
// config changes are processed in the main loop.
+ let mut config_monitor = None;
if config.live_config_reload {
- monitor::watch(config.config_paths.clone(), window_event_loop.create_proxy());
+ config_monitor =
+ ConfigMonitor::new(config.config_paths.clone(), window_event_loop.create_proxy());
}
// Create the IPC socket listener.
@@ -205,8 +208,10 @@ fn alacritty(mut options: Options) -> Result<(), Box<dyn Error>> {
// FIXME: Change PTY API to enforce the correct drop order with the typesystem.
drop(processor);
- // FIXME patch notify library to have a shutdown method.
- // config_reloader.join().ok();
+ // Terminate the config monitor.
+ if let Some(config_monitor) = config_monitor.take() {
+ config_monitor.shutdown();
+ }
// Without explicitly detaching the console cmd won't redraw it's prompt.
#[cfg(windows)]