This might be OS-dependent - on linux at least, you can create all the threads you want and have them sleep forever waiting on a mutex with no performacne hit (as far as I know anyhow).
I dont know what the ramifications would be of starting up threads only when a readsfi~ or writesf~ gets an "open" message - I don't think that would cause problems except for the slight increase in complexity of the code.
cheers Miller
On Mon, Apr 16, 2018 at 02:19:55AM +0200, Dan Wilcox wrote:
I'm working on a project with 64 soundfiler~ objects which may or may not be used all at once. I've noticed in the debugger that the each object is using a thread after instantiation, even when not actually reading a file. Is this normal? If so, what's the reasoning? I'd think it would be better, resource-wise, to spin up a thread as needed. Does starting/joining a thread take too long and break determinacy?
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev