// 001_多线程.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <windows.h>
#include <stdio.h>
DWORD WINAPI ThreadProc1(LPVOID pArg)
{
while ( 1 )
{
printf("ThreadProc1 ***\n");
printf("ThreadProc1 ...\n");
printf("ThreadProc1 +++\n");
Sleep(30);
}
return 0;
}
DWORD WINAPI ThreadProc2(LPVOID pArg)
{
while (1)
{
printf("ThreadProc1\n");
Sleep(30);
}
return 0;
}
DWORD WINAPI ThreadProc3(LPVOID pArg)
{
while (1)
{
printf("ThreadProc1\n");
Sleep(30);
}
return 0;
}
int main()
{
CreateThread(0, 0, &ThreadProc1, 0, 0, 0);
CreateThread(0, 0, &ThreadProc1, 0, 0, 0);
CreateThread(0, 0, &ThreadProc1, 0, 0, 0);
while ( 1 )
{
printf("main\n");
Sleep(30);
}
}