Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 01db9af

Browse files
committed
upgrade blocking
1 parent 4d71843 commit 01db9af

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ futures-util = { version = "0.3.4", default-features = false }
104104
argh = "0.1.3"
105105
futures = "0.3.5"
106106
atty = "0.2.14"
107-
blocking = "0.5.0"
107+
blocking = "1.0.0"
108108
multitask = "0.2.0"
109109
once_cell = "1.4.0"
110110
parking = "2.0.0"

examples/dashboard.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ async fn work_forever(mut args: args::Options) -> Result {
2626
let mut sp = progress.add_child("preparation");
2727
sp.info("warming up");
2828
smol::Task::spawn(async move {
29-
async_io::Timer::new(Duration::from_millis(500)).await;
29+
async_io::Timer::after(Duration::from_millis(500)).await;
3030
sp.fail("engine failure");
31-
async_io::Timer::new(Duration::from_millis(750)).await;
31+
async_io::Timer::after(Duration::from_millis(750)).await;
3232
sp.done("warmup complete");
3333
})
3434
.detach();
@@ -139,7 +139,7 @@ async fn work_item(mut progress: Item, speed: f32, changing_names: bool) {
139139
if thread_rng().gen_bool(if changing_names { 0.5 } else { 0.01 }) {
140140
progress.set_name(WORK_NAMES.choose(&mut thread_rng()).unwrap().to_string());
141141
}
142-
async_io::Timer::new(Duration::from_millis((delay_ms as f32 / speed) as u64)).await;
142+
async_io::Timer::after(Duration::from_millis((delay_ms as f32 / speed) as u64)).await;
143143
}
144144
if thread_rng().gen_bool(0.95) {
145145
progress.done(*DONE_MESSAGES.choose(&mut thread_rng()).unwrap());
@@ -165,7 +165,7 @@ async fn new_chunk_of_work(max: NestingLevel, tree: Tree, speed: f32, changing_n
165165
));
166166
handles.push(handle);
167167

168-
async_io::Timer::new(Duration::from_millis((SPAWN_DELAY_MS as f32 / speed) as u64)).await;
168+
async_io::Timer::after(Duration::from_millis((SPAWN_DELAY_MS as f32 / speed) as u64)).await;
169169
}
170170
if level + 1 != max_level {
171171
let tmp = level_progress.add_child(format!("Level {}", level + 1));

examples/shared/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn launch_ambient_gui(
5656
},
5757
);
5858
handle.disconnect();
59-
blocking::unblock!(handle.wait());
59+
blocking::unblock(move || handle.wait()).await;
6060
}
6161
.boxed(),
6262
"tui" => tui::render_with_input(

0 commit comments

Comments
 (0)