Inter/Intra Process Lock


I'm trying to give each instance of my plugin a random name, my idea was to create an InterProcessLock() with the name, and each plugin would randomly try names from a list until it could enter the lock. Except 1 process can enter a InterProcessLock mutliple times. I don't know if the host is going to run each plugin in it's own process or not.

Is there anything like the InterProcessLock that locks a process from entering multiple times as well?


Can't you just create a singleton / shared resource pointer object that'll be shared with all your plugins and use a regular lock?

class RandomNameGen { public: String getName() { ScopedLock lock(criticalSection); String name = getRandomNameInternalWorkings(); return name; } private: CriticalSection criticalSection; };

Or something like that...?