How to share global variables between threads? #9445
Unanswered
DennisZhangOiler
asked this question in
Q&A
Replies: 1 comment 2 replies
-
let (image_sender, image_receiver) = smol::channel::unbounded();
// send `image_sender` to a background thread of yours that feeds images
slint::spawn_local(async move {
loop {
if let Ok(image_update) = image_receiver.recv().await {
let (row, image) = ...
your_vec_model.set_row_data(row, image); // or append, etc.
}
}
})?; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Current implementation of global variable uses ModelRc, but I need to update them from different threads. The background is I am writing a multiple livestreams processing APP, it needs to render images captured from livestreams and keep updating them.
Beta Was this translation helpful? Give feedback.
All reactions