
Anthony Williams wrote:
Windows named mutexes do give you exactly this functionality, though as they are kernel objects you don't get the "fast path" options of a roll-your-own mutex.
If the name for your mutex includes the process ID and &afoo, then Windows will give you a distinct mutex for each distinct foo object. You need the process ID, so you don't get a clash with mutexes in other processes, since named mutexes are system-global.
Yes, of course. I already mentioned that the idea might sound all to trivial. A similar mutex also exists e.g. on linux. You are pointing at the similarities. But I want to show the differences. In my case I simply use the standard" process-local mutex, but wrapping it into a "name-generator". In this respect my "idea" is different from op-sys named mutices. op-sys mutices are always system global aren't they? (Given the name is unique.) Consequently my approach gives you a fast-pathed mutex if you need it, without loss of the "named" feature. Roland