windows-nt/Source/XPSP1/NT/base/win32/client/killer.c

50 lines
922 B
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include <stdio.h>
#include <windows.h>
Spin()
{
int i;
for (i=0;1;i++) {
Sleep(i*7500);
}
}
void
main(void)
{
DWORD ThreadId;
HANDLE Thread;
int i;
int failcount;
failcount = 0;
for (i = 0;; i++) {
Thread = CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE)Spin,
NULL,
0,
&ThreadId
);
if ( (i/50)*50 == i ) {
printf("%d threads created\n", i);
}
if (!Thread) {
failcount++;
printf("%d threads created before %d failure\n", i,failcount);
Sleep(5000);
if ( failcount < 10 ) {
i--;
goto again;
}
break;
}
else {
CloseHandle(Thread);
}
again:;
}
}