您的位置:首页 > 编程语言 > C语言/C++

C++多线程

2011-04-03 13:20 204 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: