ThreadPool和Consumer Producer设计模式之间有什么区别 [英] What's the difference between ThreadPool and Consumer Producer design pattern

查看:106
本文介绍了ThreadPool和Consumer Producer设计模式之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

托管线程(消费者/生产者)和ThreadPool之间是否存在差异?若有,有什么优点和缺点?

解决方案

ThreadPool [ ^ ]是一个不合适的-box优化解决方案,应该用来代替滚动您自己的线程提供商。 除非您有 ThreadPool 未满足的特殊要求,否则我建议您继续使用现有的实现。



另外请参阅 this [ ^ ]最优秀的链接,可以进行更深入的分析。



/ ravi

Is there a difference between a managed threads (consumer/producer) and ThreadPool? If so what are the pros and cons?

解决方案

ThreadPool[^] is an out-of-the-box optimized solution that should be used in lieu of rolling your own thread provider.  Unless you have special requirements not met by ThreadPool, I urge you to go with the existing implementation.

Also see this[^] most excellent link for a deeper analysis.

/ravi


这篇关于ThreadPool和Consumer Producer设计模式之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆