As far as I know, they both do not have the "async" keyword. Do they both create a new thread when downloading?
True, they do not use async
. But you don't have to use async
in order to be asynchronous.
They do not create new threads, if by that you mean that they just queue the blocking work to the thread pool. They do "use thread resources" when the operation completes, though I would say that documentation is misleading.
I've heard people say that they do not use a new thread. Then how does it do it?
See There Is No Thread. In summary, true asynchronous I/O uses callbacks, which generally ends at a completion port, which in .NET is part of the thread pool. However, there is not a thread that is blocked doing the I/O; rather, the thread pool's I/O threads (not worker threads) are used to service the completion port work as it completes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…