diff --git a/examples/simple.rs b/examples/simple.rs index afcd84906..cb6ac0435 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -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"); diff --git a/src/imap/idle.rs b/src/imap/idle.rs index 7c07bbaf9..e8e213104 100644 --- a/src/imap/idle.rs +++ b/src/imap/idle.rs @@ -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) } diff --git a/src/job.rs b/src/job.rs index 35842d84a..f7b13557f 100644 --- a/src/job.rs +++ b/src/job.rs @@ -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; } } } diff --git a/src/job_thread.rs b/src/job_thread.rs index 3676eb42e..736f85182 100644 --- a/src/job_thread.rs +++ b/src/job_thread.rs @@ -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; } }