Is CreateMutex() a atomic function?
I want to use CreateMutex() to prevent creating multiple instance of my application. But I'm not sure if two CreateMutex() could be called at the same time. If it can be happened then it can not perfectly prevent multiple instances to be created.
thanks.
Re: Is CreateMutex() a atomic function?
Yes - you can consider CreateMutex as being "atomic" with respect to other threads also calling CreateMutex with the same name.
gg
Re: Is CreateMutex() a atomic function?
Yes, any named object is unique (throughout the same desktop, I believe) as long as it's not closed.
Re: Is CreateMutex() a atomic function?
Quote:
Originally Posted by
coldstar
But I'm not sure if two CreateMutex() could be called at the same time.
Of course they could. And someone will definitely win the race. ;)