mystran wrote:Urgh.. can you maybe explain something about this "host forcing" thingie?
I mean... if I create a thread pool (ie. a bunch of threads and a queue) in the plugin (eg. either when the dynamic library is loaded or first time a plugin is instantiated.. obviously one shouldn't create threads in processing methods) and put some jobs in the queue for them to process, how is the host even supposed to know which threads are processing which plugin when the actual host thread just sits on a generic semaphore?
Your thread pool is created with the affinity mask of the calling thread, it is then your responsibility to pin them to cores inside that affinity mask.
Ok.. so you're saying that a certain host exists that uses a thread with reduced affinity mask to create plugin instances. In my book, that translates to "add code to thread creation to ensure that the CPU affinity mask is reset back to all CPUs".
I would actually really appreciate the specifics of "which hosts" do this, because I would like to test this.
And you are screwed in the host defines an affinity mask for the thread used to create your plugin (which may not even be the audio thread, so all thread pools may end up sharing one core, for instance, the GUI one).
I would like to argue that if a given host loads plugins from audio thread, it's certainly FUBAR (that's a technical term)... but that's sort of not important. What's important is that if you are correct and there are hosts that play retard and go pinning their CPUs, then apparently it's necessary for plugin code to sanity check and undo the damage. Doesn't seem like a big deal, as you already have to do a bunch of low-level system-specific crap to get your threads running on real-time priorities and all.
So once again, very _bad_ practice to use thread pools in a plugin. If you want to, ask Apple and Steinberg to add the proper API to their interfaces.
When your choices come down to hitting the audio deadline or not, the question of "good" and "bad" tend to become quite meaningless and the actually interesting question is "what do I have to do to make it work" instead.