<分区>
我正在使用 async-await
和任务,但我无法理解一件事:
异步任务是否在单独的线程中执行?
正如 msdn 所说 ( Asynchronous programming ):
The async and await keywords don't cause additional threads to be created. Async methods don't require multithreading because an async method doesn't run on its own thread.
但是在 ThreadPool
类(ThreadPool Class)描述的备注中:
Examples of operations that use thread pool threads include the following:
When you create a Task or Task object to perform some task asynchronously, by default the task is scheduled to run on a thread pool thread.
所以,现在我不明白 async
任务是否使用单独的线程。请解释一下。谢谢。