Difference between the TPL & async/await (Thread handling)

前端 未结 2 711
不知归路
不知归路 2020-11-28 19:08

Trying to understanding the difference between the TPL & async/await when it comes to thread creation.

I believe the TPL (Task

2条回答
  •  执念已碎
    2020-11-28 19:37

    async / await basically simplifies the ContinueWith methods ( Continuations in Continuation Passing Style )

    It does not introduce concurrency - you still have to do that yourself ( or use the Async version of a framework method. )

    So, the C# 5 version would be:

    await Task.Run( () => DoSomeAsyncWork() );
    DoSomeWorkAfter();
    

提交回复
热议问题