Skip to content

Commit

Permalink
use Timer::interval to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Nov 29, 2020
1 parent b387397 commit e8ab93b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crossterm::{
ExecutableCommand,
};
use dirs_next::config_dir;
use futures_lite::StreamExt;
use structopt::StructOpt;
use tui::{backend::CrosstermBackend, widgets::ListState, Terminal};

Expand Down Expand Up @@ -166,11 +167,11 @@ async fn run() -> Result<()> {

thread::spawn(move || {
block_on(async move {
let mut timer = Timer::interval(update_interval);
loop {
let timer = Timer::after(update_interval);
updates2.fetch_or(0b101, Ordering::Relaxed);
t2.unpark();
timer.await;
timer.next().await;
}
})
});
Expand Down

0 comments on commit e8ab93b

Please sign in to comment.