TPL使用任务调度程序来协调任务。据正式文件,默认任务调度程序使用线程池,但是,如果 TaskCreationOptions.LongRunning
选项psented那么它会创建一个专用线程,该任务(A)。
TPL uses Task Schedulers to coordinate tasks. According to official document, default task scheduler uses Thread Pool, but if TaskCreationOptions.LongRunning
option is presented then it will create a dedicated thread for that task (A).
问:截至目前MSDN文档为Visual Studio 2010还没有准备好和当前在线MSDN尚未敲定;没有任何人知道,如果(A)是真还是假?
Question: As of now MSDN documents for Visual Studio 2010 are not ready and current online MSDN is not finalized; does anyone knows if (A) is true or false?
是 LongRunning
强制创建池外一个新的线程。下面是最新的架构版本的一些伪拆解code:
Yes, LongRunning
forces the creation of a new thread outside the pool. Here's some pseudo-disassembled code from the latest framework version:
...
if (task.Options HasFlag LongRunning) then
create new Thread thread
thread.Start(task)
...
编辑:从丑陋的C#转换为伪code 的