TaskScheduler
Async Await 异步的实现原理,老是被问到, 看了Go的调度器文章,设计上感觉跟这个很相似。
这应该会是一个系列文章, 一篇写不下的, 欠的债慢慢还!
参考文章
https://stackoverflow.com/questions/14177891/understanding-async-await-in-c-sharp
https://blog.stephencleary.com/2012/02/async-and-await.html
https://stackoverflow.com/questions/17320595/replacing-the-task-scheduler-in-c-sharp-with-a-custom-built-one
https://www.codeproject.com/Articles/31971/Understanding-SynchronizationContext-Part-I
https://stackoverflow.com/questions/15428604/how-to-run-a-task-on-a-custom-taskscheduler-using-await
https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskscheduler?view=net-6.0
https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskscheduler?view=net-6.0#Sync
https://devblogs.microsoft.com/pfxteam/taskscheduler-fromcurrentsynchronizationcontext/