async sleep

This commit is contained in:
dignifiedquire
2020-03-04 17:27:25 +01:00
parent 43a8828430
commit 62bfa5157b
4 changed files with 6 additions and 6 deletions

View File

@@ -82,7 +82,7 @@ async fn main() {
.unwrap();
ctx.configure().await;
thread::sleep(duration);
async_std::task::sleep(duration).await;
println!("sending a message");
let contact_id = Contact::create(&ctx, "dignifiedquire", "dignifiedquire@gmail.com").unwrap();
@@ -101,7 +101,7 @@ async fn main() {
println!("chat: {} - {:?} - {:?}", i, text1, text2,);
}
thread::sleep(duration);
async_std::task::sleep(duration).await;
println!("stopping threads");

View File

@@ -283,7 +283,7 @@ impl Imap {
// not have entered idle_wait yet, give it some time
// for that to happen. XXX handle this without extra wait
// https://github.com/deltachat/deltachat-core-rust/issues/925
std::thread::sleep(Duration::from_millis(200));
async_std::task::sleep(Duration::from_millis(200)).await;
info!(context, "low-level: dropping stop-source to interrupt idle");
std::mem::drop(interrupt)
}

View File

@@ -675,7 +675,7 @@ pub async fn perform_smtp_jobs(context: &Context) {
}
pub async fn perform_smtp_idle(context: &Context) {
info!(context, "SMTP-idle started...",);
info!(context, "SMTP-idle started...");
let perform_jobs_needed = context.smtp.state.read().await.perform_jobs_needed.clone();
@@ -1027,7 +1027,7 @@ async fn suspend_smtp_thread(context: &Context, suspend: bool) {
if !context.smtp.state.read().await.doing_jobs {
return;
}
std::thread::sleep(time::Duration::from_micros(300 * 1000));
async_std::task::sleep(time::Duration::from_micros(300 * 1000)).await;
}
}
}

View File

@@ -46,7 +46,7 @@ impl JobThread {
if !using_handle {
return;
}
std::thread::sleep(std::time::Duration::from_micros(300 * 1000));
async_std::task::sleep(std::time::Duration::from_micros(300 * 1000)).await;
}
}