Search code examples
.netasynchronousasync-awaitsynchronous

Is synchronous and await asynchronous just not the same thing?


I don't know if this question is dumb or not but I've seen a lot of different scenarios of async, await and sync methods. All I understand is that you're simply not "blocking the thread" from doing other tasks.

But when you're using an await on a task isn't that just simply waiting for the value to come back and in that case sync synchronous?

I'm using the .NET framework


Solution

  • when you're using an await on a task isn't that just simply waiting for the value to come back and in that case sync synchronous?

    There is a fundamental misunderstanding here. An await is not a Wait() instruction. It is closer to a return. If the task isn't finished yet, await returns control to the caller immediately.

    The rest of your method is posted as a separate task, with no guarantee when it will execute. That is what makes it asynchronous.