Thread.Start() versus ThreadPool.QueueUserWorkItem()

前端 未结 7 2109
长发绾君心
长发绾君心 2020-12-12 16:20

The Microsoft .NET Base Class Library provides several ways to create a thread and start it. Basically the invocation is very similar to every other one providing the same k

7条回答
  •  一生所求
    2020-12-12 16:55

    The Managed Thread Pool has some very good guidelines on when NOT to use the thread pool.

    In my experience, you want to create your own thread when you need a persistent, dedicated, long-running thread. For everything else, use asynchronous delegates or something like QueueUserWorkItem, BackgroundWorker, or the Task-related features of .NET 4.0.

提交回复
热议问题