VC 的任务执行框架++?
有谁知道 VC++ 2008 中的 Java ExecutorService 等效项吗?我想要的是一个可以将任务传递给固定大小线程池的框架。框架应该管理线程池本身(即线程的创建和销毁)。
Does anyone know of a Java ExecutorService equivlent in VC++ 2008? What I want is a framework which I can pass tasks to fixed size thread pool. The framework should manage the thread pool itself (i.e. creation and destruction of threads).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为英特尔线程构建模块支持类似的东西。 Visual Studio 2010 将具有并行模式库。
I think Intel Threading Building Blocks supports something like this. Visual Studio 2010 will have Parallel Patterns Library.
Vista 有一个新的线程池 API(除了 Windows 已经有一段时间的现有的、相当斯巴达的线程池 API 之外): http://msdn.microsoft.com/en-us/library/ms686766%28VS.85%29.aspx 。此 API 不绑定到任何特定版本的 MSVC/VS,但当然要使用新功能,您需要拥有 Vista/Server 2008 或更高版本。
QueueUserWorkItem
和RegisterWaitForSingleObject
可能足以满足您的需求。正如 Nikola 指出的,2010 年将有 PPL。如果您可以针对 C# 或 C++/CLI 而不是 C++ 进行编码,.NET 还具有一些不错的线程池 api。Vista has a new thread pool API (in addition to existing, rather spartan thread pool API windows has had for a while): http://msdn.microsoft.com/en-us/library/ms686766%28VS.85%29.aspx . This API is not bound to any specific version of MSVC/VS but of course to use the new stuff you need to have Vista/Server 2008 or better.
QueueUserWorkItem
andRegisterWaitForSingleObject
may be sufficient for your needs. As Nikola points out, 2010 will have the PPL. .NET also has some nice thread pool apis if you can code against C# or maybe C++/CLI instead of C++.