scroll mode for very long start menus
[reactos.git] / reactos / apps / tests / terminate / terminate.c
1 #define UNICODE
2
3 #define NTOS_MODE_USER
4 #include <ntos.h>
5 #include <windows.h>
6 #include <stdio.h>
7
8 #define DBG
9 #define NDEBUG
10 #include <debug.h>
11
12 static volatile DWORD z;
13 static volatile DWORD x=0;
14
15 static NTSTATUS STDCALL
16 thread_1(PVOID Param)
17 {
18 DWORD y=0;
19
20 for(;;)
21 {
22 z++;
23 if(x>50)
24 {
25 Sleep(100);
26 x=0;y++;
27 if(y==3) return(0);
28 }
29 }
30 }
31
32 int
33 main(int argc, char *argv[])
34 {
35 HANDLE thread;
36 DWORD thread_id;
37 CONTEXT context;
38 DWORD z = 0;
39
40 context.ContextFlags=CONTEXT_CONTROL;
41
42 while (z < 50)
43 {
44 TerminateThread(thread, 0);
45 z++;
46 thread=CreateThread(NULL,
47 0x1000,
48 (LPTHREAD_START_ROUTINE)thread_1,
49 NULL,
50 0,
51 &thread_id);
52
53 if(!thread)
54 {
55 printf("Error: could not create thread ...\n");
56 ExitProcess(0);
57 }
58
59 Sleep(1000);
60
61 printf("T");
62 if ((z % 5) == 0)
63 {
64 TerminateThread(thread, 0);
65 }
66 printf("C");
67 GetThreadContext(thread, &context);
68 printf("S");
69 SuspendThread(thread);
70 printf("R");
71 ResumeThread(thread);
72 }
73
74 ExitProcess(0);
75 return(0);
76 }