关于互斥器,先看MSDN介绍:
Mutex Objects
A mutex object is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource.
即:Mutex可以被某一个线程在某一时刻被单独拥有,Mutex从有信号转变成无信号。
初始化
A thread uses the CreateMutex orCreateMutexEx function to create a mutex object. The creating thread can request immediate ownership of the mutex object and can also specify a name for the mutex object. It can also create an unnamed mutex.