Multithreading are very interesting part of programming languages. Visual C++ offers many ways to support multithreading. You can create thread easily using _beginthread function.
Mutex objects are used to synchronize between multiple processes rather than multithread. Named mutexes can be created and accessed between two applications (client/server or peer to peer).
In this example, I have written one application using mutex. It will check whether any other instances of the same application is running or not. If another instance is running, then it will display the message "another instance of the same application is running" and then it will exit.
Note that if you are using mutex between multiple threads and mutex object is defined globally, the thread which is locking should be responsible for unlocking the mutex object. If you try unlock the mutex object with another thread, it would fail with the GetLastError return code - 288 ERROR_NOT_OWNER - Attempt to release mutex not owned by caller.
For source code, visit at: http://www.softwareandfinance.com/Visual_CPP/MultiThread_Mutex.html