Thread vs ThreadPool

后端 未结 11 2296
鱼传尺愫
鱼传尺愫 2020-11-22 15:57

What is the difference between using a new thread and using a thread from the thread pool? What performance benefits are there and why should I consider using a thread from

11条回答
  •  日久生厌
    2020-11-22 16:25

    If you need a lot of threads, you probably want to use a ThreadPool. They re-use threads saving you the overhead of thread creation.

    If you just need one thread to get something done, Thread is probably easiest.

提交回复
热议问题