C++ 多线程实例一

来源:互联网 发布:英语信件开头问候 知乎 编辑:程序博客网 时间:2024/04/29 19:24

 

#include <iostream>
#include <windows.h>
using namespace std;
DWORD WINAPI Fun(LPVOID IpParamter){
 while(1){
 cout<<"Fun display!"<<endl;
 Sleep(1000);
}
}
int main(int argc,char *argv[]){
 HANDLE hThread=CreateThread(NULL,0,Fun,NULL,0,NULL);
 CloseHandle(hThread);
 while(1){
 cout<<"main display!"<<endl;
 Sleep(2000);
 }
 return 0;
}

原创粉丝点击