#include
#include
int n, sec;
DWORD dwThreadID;
DWORD WINAPI Thread(void *arg)
{
Sleep(4000);
n = 1;
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
n = 0;
sec = 0;
printf("Create Thread...\n");
CreateThread(NULL,0,Thread, NULL, 0, &dwThreadID);
while(1)
{
printf("%d sec: n = %d\n", sec, n);
Sleep(1000);
sec++;
}
return 0;
}
No comments:
Post a Comment