Threading advice in Juce library


#1

Hi Jules!

I am very impressed with this project. It lacks a little on documentation, but the API is easy to wade through. That said (spend some time showing us Juce n00bs how to do the real stuff, not just the basics - to showcase the awesomeness of it)

I need some advise on usage of Juce’s Threading api.

Basically, I come from a Java background, so I’ve only been recently doing cross-platform C++ development, after seeing the bad-assed-ness of c++ for myself. What I need for now is probably simple for you guys, I’m just not quite sure how it should be coded in Juce. I used Boost in the past, but decided Juce is a much better way of doing things than boost…

So let’s assume two things: reading and writing to and from multiple files, all according to page size. What’s the best (and fastest) way to multithread that in Juce? I was thinking it would be some form of ThreadPoolJobs, but I’m not quite sure how that all works - I’m new to that concept. In java, we can create a thread pool with worker threads, that basically loop over a queue. THis seems similar to that, only it seems to take care of dynamic thread pool sizes, yes? So I’m looking for two things:

  1. The most efficient way to read/write to multiple files on disk, where there will be multiple concurrent read/writes
  2. The most efficient way to thread out a server socket.

(basically, thinking along the lines of pervasive data rush in java, only utilizing just juce library apis)

Thanks a ton, Jules! Keep up the good work.


#2

Nevermind. After writing that I saw the demo file. Should be plenty well enough to get me going, and it answered my own question…

Thanks tho


#3

Someone should write a tutorial on this one.