// one.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
using namespace std;
DWORD WINAPI MyThread(void* p)
{
for(int i=0;i<100;i++)
{
cout<<"hello everyone."<<endl;
Sleep(100);
return 0;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE handle;
DWORD dw;
handle = CreateThread(NULL,0,MyThread,NULL,0,&dw);
Sleep(100);
for(int i=0;i<10;i++)
{
cout<<"now suspended "<<endl;
SuspendThread(handle);
for(int j=0;j<3;j++)
{
cout<<"good thank you"<<endl;
Sleep(100);
}
cout<<"now sesume"<<endl;
ResumeThread(handle);
Sleep(300);
}
CloseHandle(handle);
getchar();
return 0;
}