Executor provides a way to separate task submission from the mechanics of how each task will run, including details of thread usage, scheduling, and so on.

It is equivalent to a manager. The boss asks a manager to perform a task, regardless of who performs it and when.

Look at the inheritance relationship above, introduce a few

 

The built-in thread pool is basically here

 

NewScheduledThreadPool Specifies the thread pool for periodic execution

NewCachedThreadPool Cache used threads

NewFixedThreadPool Specifies a fixed number of thread pools

NewWorkStealingPool a thread pool that breaks up large tasks into smaller ones

Here we will introduce the use of thread pools one by one. Thank you for your attention

 

Welcome to reprint, I’m coriander, thank you. Welcome to join QQ group: 632603498, learn together

Blog.csdn.net/perfect2011…