如果我等待关闭的互斥锁会发生什么?
DWORD WINAPI Fun2Proc(LPVOID lpParameter // thread data)
{
while(TRUE)
{
WaitForSingleObject(hMutex,INFINITE); //what would happen here?
Sleep(1000);
ReleaseMutex(hMutex);
}
return 0;
}
HANDLE hMutex;
int main(){
HANDLE hThread2;
hMutex=CreateMutex(NULL, FALSE,"tickets");
CloseHandle(hMutex); // and closed here
hThread2=CreateThread(NULL,0,Fun2Proc,NULL,0,NULL);
CloseHandle(hThread2);
......
}