Best way to tell if DAW spawns plugins in separate processes

True, the comments have gone offtopic -that happens often. The topic, though, was elusive. You asked for a way to tell if plugins spawn in separate processes, which can be read as “knowing if there’s any instance running in another process”, then suggested saving PIDs in statics and comparing. So someone reminded that statics are per-process and thus not very useful for the topic so far. Some suggestions about shared memory were given for that topic. But then it was about telling if plugins spawn in the same process. Just in case, someone reminded that this is mostly the case. Then someone suggested using a static atomic counter, which helps with the topic (the new one). But people clearly didn’t understand. Then you showed a variant of the suggested method, using bools instead of ints. I, coming late, couldn’t think of anything simpler and “more robust” than that.

Greetings from the Global South.

1 Like

The snippet I posted wasn’t based on @JeffMcClintock proposal. It’s what I said in my OP

An obvious solution would be to store the PID in a global static and check if an existing PID matches the current PID .

As I mentioned to @PluginPenguin the actual data stored in the static is arbitrary, which is why I simplified it to a flag

I see, this is basically a variation of the solution as proposed by @JeffMcClintock and I totally understand why this works. But this has nothing to do with

as you mentioned before – since you actually don’t store the PID in this example :wink: So I still don’t know what I

about the role of the PID in all that since

which – as you mentioned – confused me after you mentioned the PID multiple times before :wink:

But glad that you now made it clear that the solution posted does not rely on the PID anymore but was simplified to a bool flag. Since it was really arbitrary – it could have also been the birthday of your dog – I think it was confusing that you mentioned the PID as a highly process-related value where any value would have done the job. Sometimes it takes a bit longer for such a thread to get every reader understand what’s meant. As everything written in such a forum always should have the goal to be informative to future readers, I think it’s well spent time to discuss such things in-depth, even if the original question could be solved.

4 Likes

Use any kind of static value to check if something happens in the same process doesn’t give you any guarantee about existence (or not) of an instance in another process. It could be enought if you care only about thread-safety (it seems your case), but not if you care also about process safety (concurrent access to nuclear engine connected or whatever…). It appears that there is no magic JUCE function to check that at plugin start. IMHO responses were not off topic at all since the original question was a little ambiguous.

3 Likes