SDK12-1,帮忙看个书上程序,
#include <windows.h>
#include <iostream.h>int main()
{
SYSTEM_INFO si;
DWORD dwProc; GetSystemInfo(&si);
cout<<"Number of available process:"<<si.dwNumberOfProcessors<<endl;
for(dwProc = 0; dwProc < si.dwNumberOfProcessors; ++dwProc)
{
//发送处理器数目并确定处理器是否是活动的
//即检测处理器能否接受线程
cout<<"Processor "<<dwProc;
if((si.dwActiveProcessorMask&(1<<dwProc)) != 0)//
cout<<" is active."<<endl;
else
cout<<" is inactive."<<endl;
}
return 0;
}输出:
Number of available process:1
Processor 0 is active.
Press any key to continue
请问,si.dwActiveProcessorMask啥意思?
1<<dwProc这个在这里又是啥意思??
#include <windows.h>
#include <iostream.h>int main()
{
SYSTEM_INFO si;
DWORD dwProc; GetSystemInfo(&si);
cout<<"Number of available process:"<<si.dwNumberOfProcessors<<endl;
for(dwProc = 0; dwProc < si.dwNumberOfProcessors; ++dwProc)
{
//发送处理器数目并确定处理器是否是活动的
//即检测处理器能否接受线程
cout<<"Processor "<<dwProc;
if((si.dwActiveProcessorMask&(1<<dwProc)) != 0)//
cout<<" is active."<<endl;
else
cout<<" is inactive."<<endl;
}
return 0;
}输出:
Number of available process:1
Processor 0 is active.
Press any key to continue
请问,si.dwActiveProcessorMask啥意思?
1<<dwProc这个在这里又是啥意思??
dwActiveProcessorMask这个值中,如果第n位为1那么第n个处理器就是活动状态,可以使用
2。1<<dwProc这个在这里又是啥意思??
------ 移位操作`
dwActiveProcessorMask
Specifies a mask representing the set of processors configured into the system. Bit 0 is processor 0; bit 31 is processor 31. Bit 0 is processor 0; bit 31 is processor 31. 这话啥意思?