Limited update loop speed using sleep()

This commit is contained in:
Silas Bartha 2023-12-29 18:29:21 -05:00
parent a91ff86876
commit 3fe873c00c
Signed by: soaos
GPG Key ID: 9BD3DCC0D56A09B2
3 changed files with 4 additions and 3 deletions

2
Cargo.lock generated
View File

@ -959,7 +959,7 @@ dependencies = [
[[package]] [[package]]
name = "pomd" name = "pomd"
version = "1.2.0" version = "1.3.0"
dependencies = [ dependencies = [
"async-std", "async-std",
"confy", "confy",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "pomd" name = "pomd"
version = "1.2.0" version = "1.3.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -1,6 +1,6 @@
use std::{ use std::{
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::Duration, time::Duration, thread::sleep,
}; };
use pausable_clock::{PausableClock, PausableInstant}; use pausable_clock::{PausableClock, PausableInstant};
@ -164,5 +164,6 @@ async fn main() -> Result<()> {
.await?; .await?;
loop { loop {
pomd.lock().unwrap().update(); pomd.lock().unwrap().update();
sleep(Duration::from_millis(100));
} }
} }