|
-
August 17th, 2010, 01:27 PM
#1
Multi-threading and Accessing a Mutex
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|