程序没有出现预想的结果,为什么?
#include <windows.h>#include <iostream.h>
DWORD WINAPI Fun1Proc(LPVOID lpParameter);
void main(){
HANDLE thread_1;
thread_1=::CreateThread(NULL,0,Fun1Proc,NULL,0,NULL);
::CloseHandle(thread_1);
cout<<"main thread is running!"<<endl;
::Sleep(10);
}
DWORD WINAPI Fun1Proc(LPVOID lpParameter){
cout<<"thread_1 is running!"<<endl;
return 0;
}
结果:main thread is running!
main thread is running!
thread_1 is running!
为什么?