Improve Timer creation #5030
Unanswered
otiv-wannes-vanleemput
asked this question in
General
Replies: 1 comment 1 reply
-
Looking at your code now, I realize that Timer is Send, but it shouldn't be.
You're right that this is not very pretty code and we should do better. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all!
I'm developing a real-time video stream application, which uses a combination of Rust, Slint and Gstreamer.
To ensure the video being real-time, I constructed a Timer which fires after x ms, with a callback that shuts down the application. This timer resets every time a GStreamer AppSink receives a new sample (frame).
The main issue here is that the creation of the timers happens before the main application loop, but I want to define the callback on the timer at creation.
This is a sample of what the code could look like:
I'm starting and then stopping the timer to be able to set the callback, is there a way to make this more efficient?
It would be nice if it were possible to add this callback on creation, and then being able to start the timer with the callback in place.
Beta Was this translation helpful? Give feedback.
All reactions