You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can i trigger a simple Label to update from another thread?
As soon as i enter the event loop the thread becomes blocking, until a event is called.
But as far as i can see these events are only internal events such as mouse move events.
If i want to use EventLoop#next_tick, i need the UI which is a Rc<iui::ui::UIToken which i can only call from the owning thread. If i want to update the Label, the same occurs. How can i change it?
Maybe i did understand something wrong, if so feel free to correct me :)
Also another question: The Label seems to flash quickly as i update it. Is this expected behaviour?
The text was updated successfully, but these errors were encountered:
I use Tokio watch channels to communicate between tasks. I spawn an asynchronous task and pass the sender half of the channel as one of its arguments, and keep the receiver half in the UI event loop. In the loop, I use a Tokio select macro with a branch that checks the channel for changes (usually several of these, depending on the UI design) and a default branch that sleeps asynchronously for 5 ms and then executes the next tick in the event loop. The updated UI component will retain its value until something new is sent through the channel. I haven't had to use any reference counters with this pattern.
How can i trigger a simple
Label
to update from another thread?As soon as i enter the event loop the thread becomes blocking, until a event is called.
But as far as i can see these events are only internal events such as mouse move events.
If i want to use
EventLoop#next_tick
, i need the UI which is aRc<iui::ui::UIToken
which i can only call from the owning thread. If i want to update theLabel
, the same occurs. How can i change it?Maybe i did understand something wrong, if so feel free to correct me :)
Also another question: The
Label
seems to flash quickly as i update it. Is this expected behaviour?The text was updated successfully, but these errors were encountered: