windows 程序设计2 中的例子 一点疑惑
#include"windows.h"#include"stdio.h"
DWORD WINAPI ThreadIdle(LPVOID lpParam) //03PriorityDemoG
{
int i=0;
while(i++<3)
printf("Idle Thread is running\n");
return 0;
}
DWORD WINAPI ThreadNormal(LPVOID lpParam)
{
int j=0;
while(j++<3)
printf("normal Thread is running\n");
return 0;
}
int main(int argc, char* argv[])
{
DWORD dwThreadID;
HANDLE h[2];
h[0]=::CreateThread(NULL,0,ThreadIdle,NULL,CREATE_SUSPENDED,&dwThreadID);
::SetThreadPriority(h[0],THREAD_PRIORITY_IDLE);
::ResumeThread(h[0]);
h[1]=::CreateThread(NULL,0,ThreadNormal,NULL,0,&dwThreadID);
::WaitForMultipleObjects(2,h,TRUE,INFINITE);
::CloseHandle(h[0]);
::CloseHandle(h[1]);
return 0;
}
这个是windows 程序设计2的代码 线程优先级别代码
我的运行结果是
Idle Thread is running
Idle Thread is running
Idle Thread is running
normal Thread is running
Idle Thread is running
normal Thread is running
normal Thread is running
Press any key to continue
而windows 程序设计2 这本书输出结果是
normal Thread is running
normal Thread is running
normal Thread is running
Idle Thread is running
Idle Thread is running
Idle Thread is running
Press any key to continue
请大侠们看一下是怎么回事 是否是我的编译器有问题