C ++ master / worker [英] C++ master/worker

查看:365
本文介绍了C ++ master / worker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个跨平台的C ++主/工作库或工作队列库。一般的想法是,我的应用程序将创建某种类型的任务或工作对象,将它们传递到工作主工作队列,这将反过来在单独的线程或进程中执行工作。为了提供一点上下文,应用程序是一个CD ripper,我想要并行化的任务是像rip track,encode WAV to Mp3等。

I am looking for a cross-platform C++ master/worker library or work queue library. The general idea is that my application would create some sort of Task or Work objects, pass them to the work master or work queue, which would in turn execute the work in separate threads or processes. To provide a bit of context, the application is a CD ripper, and the the tasks that I want to parallelize are things like "rip track", "encode WAV to Mp3", etc.

我的基本要求是:


  • 必须支持可配置的并发任务数。

  • 必须支持任务之间的依赖关系,以便在所有依赖任务完成之前不会执行任务。

  • 必须允许取消任务(至少不会阻止我编码

  • 必须允许将状态和进度信息报告回主应用程序线程。

  • 必须在Windows上工作, Mac OS X和Linux

  • 必须是开放源代码。

  • Must support a configurable number of concurrent tasks.
  • Must support dependencies between tasks, such that tasks are not executed until all tasks that they depend on have completed.
  • Must allow for cancellation of tasks (or at least not prevent me from coding cancellation into my own tasks).
  • Must allow for reporting of status and progress information back to the main application thread.
  • Must work on Windows, Mac OS X, and Linux
  • Must be open source.

如果此库也:


  • 集成了Qt的信号/槽机制。

  • 支持使用

通过类比,我在寻找类似的东西Java的ExecutorService或者其他类似的线程池库,但是在跨平台的C ++中。有人知道这样的野兽吗?

By way of analogy, I'm looking for something similar to Java's ExecutorService or some other similar thread pooling library, but in cross-platform C++. Does anyone know of such a beast?

谢谢!

推荐答案

我认为这需要英特尔的线程构建模块,这几乎是你想要的。

I think this calls for intel's Threading Building Blocks, which pretty much does what you want.

这篇关于C ++ master / worker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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