Callback example #5269
Unanswered
devendranaga
asked this question in
General
Replies: 1 comment 2 replies
-
To run some code once a timer expires, you can do this. tokio::spawn(async {
tokio::time::sleep(my_duration).await;
// run your code here
}); As for sockets, you can similarly use an |
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.
-
Hello,
How do i use tokio to register and perform callbacks when there is timer expiry or socket events? The callback function may be in a different
impl
of a different file. And there can be many callbacks as possible.Thanks,
Dev
Beta Was this translation helpful? Give feedback.
All reactions