I'm writing a network-bound application based on await/sleep paradigm.
Sometimes, connection errors happen, and in my experience it pays to wait for some time and then retry operation again.
The problem is that if I use Thread.Sleep or another similar blocking operation in await/async, it blocks all activity in the caller thread.
What should I replace Thread.Sleep(10000) with to achieve the same effect as
await Thread.SleepAsync(10000)
?
UPDATE
I'll prefer an answer which does this without creating any additional thread
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…