Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Threading Building Blocks (TBB) for Qt-based CD ripper?

I am building a CD ripper application in C++ and Qt. I would like to parallelize the application such that multiple tracks can be encoded concurrently. Therefore, I have structured the application in such a way that encoding a track is a "Task", and I'm working on a mechanism to run some number of these Tasks concurrently. I could, of course, accomplish this using threads and write my own Task queue or work manager, but I thought Intel's Threading Building Blocks (TBB) might be a better tool for the job. I have a couple of questions, however.

  1. Is encoding a WAV file into a FLAC, Ogg Vorbis, or Mp3 file something that would work well as a tbb::task? The tutorial document states that "if threads block frequently, there is a performance loss when using the task scheduler". I don't think my encoding tasks would block for mutexes frequently, but the will need to access disk relatively frequently, since they must read the WAV data from disk in order to encode. Is this level of disk activity problematic in the sense described by the tutorial?
  2. Does TBB work well with Qt? When using Qt threads, you can use Qt's signals/slots mechanism transparently across threads. Would the same be true if I were using tbb::tasks instead of Qt threads? Would there be any other "gotchas"?

Thanks for any insights you can provide.

like image 631
Jason Voegele Avatar asked Oct 14 '22 15:10

Jason Voegele


1 Answers

Why not using Qt Concurrent ?

like image 158
Ariya Hidayat Avatar answered Oct 18 '22 03:10

Ariya Hidayat