ReactOS 0.4.15-dev-7958-gcd0bb1a
threadwait.c
Go to the documentation of this file.
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
14DWORD __stdcall threadfunc(void* UNREFERENCED)
15{
16 printf("Thread: Initialized\n");
17 Sleep(2500);
18 printf("Thread: Terminating...\n");
19 return 0;
20}
21
22int main(int ac, char **av)
23{
24 DWORD id;
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");
31 printf("Main: OK, somebody fixed the PsUnblockThread spinlock double-acquire crash\n");
33 printf("Main: Terminating...\n");
34 return 0;
35}
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
int main()
Definition: test.c:6
#define INFINITE
Definition: serial.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define printf
Definition: freeldr.h:97
GLuint id
Definition: glext.h:5910
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
DWORD __stdcall threadfunc(void *UNREFERENCED)
Definition: threadwait.c:14
#define __stdcall
Definition: typedefs.h:25