C++多线程
时间:2011-04-03 来源:信徒.1
#include <iostream>
#include <windows.h>
using namespace std;
//函数定义
DWORD WINAPI FunProc(LPVOID lpParamter);
int index=0;
void main(){
HANDLE hThread1;
hThread1=CreateThread(NULL,0,FunProc,NULL,0,NULL);
CloseHandle(hThread1);
while(index++<1000){
cout<<"Main Thread is running"<<endl;
}
}
DWORD WINAPI FunProc(LPVOID lpParamter){
while(index++<1000){
cout<<"Thread1 is running"<<endl;
}
return 0;
}
相关阅读 更多 +










