How to get awaitable Thread.Sleep? How to get awaitable Thread.Sleep? multithreading multithreading

How to get awaitable Thread.Sleep?


The other answers suggesting starting a new thread are a bad idea - there's no need to do that at all. Part of the point of async/await is to reduce the number of threads your application needs.

You should instead use Task.Delay which doesn't require a new thread, and was designed precisely for this purpose:

// Execution of the async method will continue one second later, but without// blocking.await Task.Delay(1000);