mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
event_monitor: make it possible to subscribe to Monitor
Signed-off-by: Omer Faruk Bayram <omer.faruk@sartura.hr>
This commit is contained in:
committed by
Bo Chen
parent
654ac49bd6
commit
e02efe9ba0
@@ -319,8 +319,14 @@ pub fn start_event_monitor_thread(
|
||||
|
||||
std::panic::catch_unwind(AssertUnwindSafe(move || {
|
||||
while let Ok(event) = monitor.rx.recv() {
|
||||
let event = Arc::new(event);
|
||||
|
||||
monitor.file.write_all(event.as_bytes().as_ref()).ok();
|
||||
monitor.file.write_all(b"\n\n").ok();
|
||||
|
||||
for tx in monitor.broadcast.iter() {
|
||||
tx.send(event.clone()).ok();
|
||||
}
|
||||
}
|
||||
}))
|
||||
.map_err(|_| {
|
||||
|
||||
Reference in New Issue
Block a user