I think std::thread::sleep(...)
is not the right use case here.
Asked
Active
Viewed 858 times
1

Shepmaster
- 388,571
- 95
- 1,107
- 1,366

nomad
- 131
- 1
- 8
-
1just found [tokio_timer](https://docs.rs/tokio-timer/0.3.0-alpha.5/tokio_timer/index.html). Maybe that's what I'm looking for – nomad Jul 20 '20 at 11:18
-
If you are using aync-std, it would be [`async_std::task::sleep()`](https://docs.rs/async-std/1.6.2/async_std/task/fn.sleep.html) instead. – Sven Marnach Jul 20 '20 at 11:20
-
i'm using tokio and found this: `tokio::time::delay_for(tokio::time::Duration::from_millis(WAIT_TIME_INTERVAL_MS));` I think that's it. – nomad Jul 20 '20 at 11:21
-
*`std::thread::sleep(...)` is not the right use case* — You are completely correct. See [Why does Future::select choose the future with a longer sleep period first?](https://stackoverflow.com/q/48735952/155423) – Shepmaster Jul 20 '20 at 14:32
-
yep, thanks @Shepmaster – nomad Jul 20 '20 at 14:36