mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 02:25:28 +03:00
mux: add notify_from_any_thread helper
This commit is contained in:
parent
6e06b9af02
commit
aa3d722e1f
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user