Skip to content

Commit

Permalink
upgrade blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 13, 2020
1 parent 4d71843 commit 01db9af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ futures-util = { version = "0.3.4", default-features = false }
argh = "0.1.3"
futures = "0.3.5"
atty = "0.2.14"
blocking = "0.5.0"
blocking = "1.0.0"
multitask = "0.2.0"
once_cell = "1.4.0"
parking = "2.0.0"
Expand Down
8 changes: 4 additions & 4 deletions examples/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async fn work_forever(mut args: args::Options) -> Result {
let mut sp = progress.add_child("preparation");
sp.info("warming up");
smol::Task::spawn(async move {
async_io::Timer::new(Duration::from_millis(500)).await;
async_io::Timer::after(Duration::from_millis(500)).await;
sp.fail("engine failure");
async_io::Timer::new(Duration::from_millis(750)).await;
async_io::Timer::after(Duration::from_millis(750)).await;
sp.done("warmup complete");
})
.detach();
Expand Down Expand Up @@ -139,7 +139,7 @@ async fn work_item(mut progress: Item, speed: f32, changing_names: bool) {
if thread_rng().gen_bool(if changing_names { 0.5 } else { 0.01 }) {
progress.set_name(WORK_NAMES.choose(&mut thread_rng()).unwrap().to_string());
}
async_io::Timer::new(Duration::from_millis((delay_ms as f32 / speed) as u64)).await;
async_io::Timer::after(Duration::from_millis((delay_ms as f32 / speed) as u64)).await;
}
if thread_rng().gen_bool(0.95) {
progress.done(*DONE_MESSAGES.choose(&mut thread_rng()).unwrap());
Expand All @@ -165,7 +165,7 @@ async fn new_chunk_of_work(max: NestingLevel, tree: Tree, speed: f32, changing_n
));
handles.push(handle);

async_io::Timer::new(Duration::from_millis((SPAWN_DELAY_MS as f32 / speed) as u64)).await;
async_io::Timer::after(Duration::from_millis((SPAWN_DELAY_MS as f32 / speed) as u64)).await;
}
if level + 1 != max_level {
let tmp = level_progress.add_child(format!("Level {}", level + 1));
Expand Down
2 changes: 1 addition & 1 deletion examples/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn launch_ambient_gui(
},
);
handle.disconnect();
blocking::unblock!(handle.wait());
blocking::unblock(move || handle.wait()).await;
}
.boxed(),
"tui" => tui::render_with_input(
Expand Down

0 comments on commit 01db9af

Please sign in to comment.