//可使双核CPU的使用率达到100%的一个小程序 #include <windows.h> #include <iostream> using namespace std; DWORD WINAPI ThreadProc( LPVOID lpParameter ) { for(;;); return 0; } int main(void) { HANDLE h[2]; h[0] = CreateThread(NULL,0,ThreadProc,0,0,0); h[1] = CreateThread(NULL,0,ThreadProc,0,0,0); WaitForMultipleObjects(2,h,true,INFINITE); return 0; }