Windows NT



         

1 Windows 2000 Professional


, () . , :

thread()

{

int a, b;

while(!f) Sleep(0);

while (f != 2);

while(1)

{

for (a = 1; a< 100; a++) b = b + (b % a);

}

}

#define defNthr 300

#define argNthr ((argc > 1)?atol(argv[1]):defNthr)

main(int argc, char **argv)

{

int a, zzz;

SYSTEMTIME st;

printf("creating %d threads...", argNthr);

for (a = 0; a < argNthr; a++)

CreateThread(0, 0, (void*)thread, 0,0, &zzz);

f = 1; printf("OK\n");

Sleep(0); f = 2;

while(1)

{

GetSystemTime(&st);

printf("* %02d:%02d:%02d\n",st.wHour, st.wMinute, st.wSecond);

Sleep(0);

}

return 0;

}