Global namespace for windows mutexes in InterProcessLock


#1

From reading http://msdn.microsoft.com/en-us/library/aa382954%28VS.85%29.aspx, it seems this change to InterProcessLock::enter in juce_win32_Threads.cpp would mean that apps in different sessions (due to services or fast-user switching) would all use the same namespace:

-        internal = CreateMutex (0, TRUE, name);
+        internal = CreateMutex (0, TRUE, "Global\\" + name);

#2

Well spotted! Yes, that’d certainly be a good change, thanks!


#3

I seem to have overlooked a potentially not-so-small detail when I asked to introduce “Global” at the beginning of the mutex name. Right after [quote=“http://msdn.microsoft.com/en-us/library/ms687032(VS.85).aspx”]The name can have a “Global” or “Local” prefix to explicitly create the object in the global or session name space.[/quote]comes[quote]The remainder of the name can contain any character except the backslash character ().[/quote] so I think the code in InterProcessLock::enter for win32 needs to be internal = CreateMutex (0, TRUE, "Global\\" + name.replaceCharacter('\\','/'));


#4

Thanks - yes, that’s a good safeguard to add…


#5