以下的代码:
#include <windows.h>
#include <iostream.h>DWORD WINAPI MyThread1(
  LPVOID lpParameter   // thread data
);
DWORD WINAPI MyThread2(
  LPVOID lpParameter   // thread data
);
int Index=100;
HANDLE hMutex;
void main()
{
HANDLE hThread1;
HANDLE hThread2;
hThread1=CreateThread(NULL,0,MyThread1,NULL,0,NULL);
hThread2=CreateThread(NULL,0,MyThread2,NULL,0,NULL);
CloseHandle(hThread1);
CloseHandle(hThread2); hMutex=CreateMutex(NULL,FALSE,NULL);
    Sleep(4000);
}DWORD WINAPI MyThread1(
  LPVOID lpParameter   // thread data
)
{
while(TRUE)
{
WaitForSingleObject(hMutex,INFINITE);
if(Index>0)
{
Sleep(1);
cout<<"MyThread1 Go Run:   "<<Index--<<endl;
}
else
break;
ReleaseMutex(hMutex);
}
return 0;
}DWORD WINAPI MyThread2(
  LPVOID lpParameter   // thread data
)
{
while(TRUE)
{
WaitForSingleObject(hMutex,INFINITE);
if(Index>0)
{
Sleep(1);
cout<<"MyThread2 Go Run:   "<<Index--<<endl;
}
else
break;
ReleaseMutex(hMutex);
}
return 0;
}
在运行过程中开头出现多个100的结果,请问这是怎么回事。亲高手指教。