1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 18:57:59 +03:00

mux: add notify_from_any_thread helper

This commit is contained in:
Wez Furlong 2022-11-23 09:34:56 -07:00
parent 6e06b9af02
commit aa3d722e1f
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -564,6 +564,19 @@ impl Mux {
subscribers.retain(|_, notify| notify(notification.clone()));
}
pub fn notify_from_any_thread(notification: MuxNotification) {
if let Some(mux) = Mux::get() {
mux.notify(notification)
} else {
promise::spawn::spawn_into_main_thread(async {
if let Some(mux) = Mux::get() {
mux.notify(notification);
}
})
.detach();
}
}
pub fn default_domain(&self) -> Arc<dyn Domain> {
self.default_domain
.borrow()