Async Task.Sleep() pauses everything? | Sololearn: Learn to code for FREE!

+6

Async Task.Sleep() pauses everything?

Async allows multiple codes/tasks to be runned at the same time. But when I do await Task.Sleep(1000); inside a function. It pauses all the tasks for 1second. Shouldn't only pause inside it's own function only? Also, is there anyway to make a code that pauses only a specific function instead of the whole task.

3/10/2017 11:15:26 PM

Wen Qin

3 Answers

New Answer

0

You can create a news object that estends thread, so you can sweet only this object

0

If it is C# use Thread.Threading.Sleep(100);

0

I'm not sure but I think Task.Delay should work.