Move tests from rosapps to rostests
[reactos.git] / rostests / tests / threadwait / threadwait.c
1 /*
2 * Author: Skywing (skywing@valhallalegends.com)
3 * Date: 09/09/2003
4 * Purpose: Probe for PsUnblockThread crash due to double-acquire spin lock.
5 */
6
7 #define WIN32_NO_STATUS
8 #include <windows.h>
9 #include <stdio.h>
10
11 #define NTOS_MODE_USER
12 #include <ndk/ntndk.h>
13
14 DWORD __stdcall threadfunc(void* UNREFERENCED)
15 {
16 printf("Thread: Initialized\n");
17 Sleep(2500);
18 printf("Thread: Terminating...\n");
19 return 0;
20 }
21
22 int main(int ac, char **av)
23 {
24 DWORD id;
25 HANDLE Thread;
26
27 Thread = CreateThread(0, 0, threadfunc, 0, 0, &id);
28 printf("Main: ThreadId for new thread is %08lx\n", id);
29 printf("Main: Waiting on thread...\n");
30 WaitForSingleObject(Thread, INFINITE);
31 printf("Main: OK, somebody fixed the PsUnblockThread spinlock double-acquire crash\n");
32 NtClose(Thread);
33 printf("Main: Terminating...\n");
34 return 0;
35 }