Hello everyone.

I just wanted to check if I was doing this correctly since I couldn't find anything on Google.

I'm creating a mutex and then checking and then taking ownership of it per thread and then releasing it.

But I'm not sure if I was taking ownership correctly.

Heres an example;

//Creation
bool good = false;
HANDLE goodMutex = CreateMutex(NULL,false,"goodMutex");

//Access per thread
WaitForSingleObject(goodMutex , INFINITE);
OpenMutex(SYNCHRONIZE,false, "goodMutex"); //<------ Not sure about this
good = true;
ReleaseMutex(goodMutex );


Can anyone tell me if I'm doing this right?