What's the difference


… between running N threads at priority P and one single TimeSlicedThread running N clients at priority P?


Well, i guess the main difference is that all the ‘slices’ running from a single thread are guaranteed to happen consecutively

[incidentally, it would be nice to be able to have some kind of control over the order of the slices- perhaps with a ‘priority’ in the client constructor- which is used to sort the clients in the thread. i’m sure there’s a better way, naturally! I’ve made my own before, but it’d be nice to have one as a go-to juce thread type].


So, if you’ve got some busy threads all running at the same priority, they will not be called in round-robin fashion by the OS?


well, a thread runs as a loop, and keeps going til it stops. obviously the point of threads is that they can run in parallel, so the OS isn’t going to wait for the thread’s ‘run’ to finish before moving on to the next thread.

the timesliceclient doesn’t have the same ‘run’ as a thread - it should do its task and return, and the timeslicethread ‘pumps’ these tasks out.


Or, you might have a multiprocessor or dual core machine and your threads may run simultaneously.