Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k views
in Technique[技术] by (71.8m points)

线程是先创建好,还是有任务的时候再创建?

例如有不确定数量的用户输入任务,需要线程池去消费。
那是等待有用户输入10个任务,再创建线程池消费。还是先创建好线程池,然后监控任务队列?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

不确定数据量的任务,一般都用线程池,免得一下子搞出太多线程给整挂了..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...