diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-27 08:27:14 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-27 08:27:14 +0400 |
| commit | 571768af433b0fdc653f44b7dee0ad2dda6fe344 (patch) | |
| tree | c022de422f89507444b60108abe60761db1bc7dc /src/backend/tty.rs | |
| parent | c09d5eb0487dd54d36e938978815d61aaeff58e1 (diff) | |
| download | niri-571768af433b0fdc653f44b7dee0ad2dda6fe344.tar.gz niri-571768af433b0fdc653f44b7dee0ad2dda6fe344.tar.bz2 niri-571768af433b0fdc653f44b7dee0ad2dda6fe344.zip | |
Make ipc_outputs Arc Mutex
Diffstat (limited to 'src/backend/tty.rs')
| -rw-r--r-- | src/backend/tty.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 6e923003..f9f4b19d 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -84,7 +84,7 @@ pub struct Tty { update_output_config_on_resume: bool, // Whether the debug tinting is enabled. debug_tint: bool, - ipc_outputs: Rc<RefCell<HashMap<String, niri_ipc::Output>>>, + ipc_outputs: Arc<Mutex<HashMap<String, niri_ipc::Output>>>, enabled_outputs: Arc<Mutex<HashMap<String, Output>>>, } @@ -292,7 +292,7 @@ impl Tty { dmabuf_global: None, update_output_config_on_resume: false, debug_tint: false, - ipc_outputs: Rc::new(RefCell::new(HashMap::new())), + ipc_outputs: Arc::new(Mutex::new(HashMap::new())), enabled_outputs: Arc::new(Mutex::new(HashMap::new())), }) } @@ -1410,10 +1410,11 @@ impl Tty { } } - self.ipc_outputs.replace(ipc_outputs); + let mut guard = self.ipc_outputs.lock().unwrap(); + *guard = ipc_outputs; } - pub fn ipc_outputs(&self) -> Rc<RefCell<HashMap<String, niri_ipc::Output>>> { + pub fn ipc_outputs(&self) -> Arc<Mutex<HashMap<String, niri_ipc::Output>>> { self.ipc_outputs.clone() } |
