1 /*
2  * PROJECT:         ReactOS Tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            queuetest.c
5  * PURPOSE:         Usermode QueueUserWorkItem() testing
6  * PROGRAMMERS:     Thomas Weidenmueller (w3seek@reactos.org)
7  */
8 
9 #include <windows.h>
10 #include <stdio.h>
11 
12 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
13 BOOL WINAPI QueueUserWorkItem(LPTHREAD_START_ROUTINE,PVOID,ULONG);
14 
15 #define TestProc(n) \
16 DWORD CALLBACK TestProc##n(void *ctx)\
17 {\
18     printf("TestProc%d thread 0x%lx context 0x%p\n", n, GetCurrentThreadId(), ctx);\
19     return 0;\
20 }
21 
22 TestProc(1)
23 TestProc(2)
24 TestProc(3)
25 TestProc(4)
26 TestProc(5)
27 TestProc(6)
28 
29 int __cdecl
30 main(int argc, char* argv[])
31 {
32     PVOID x = (PVOID)0x12345;
33     QueueUserWorkItem(TestProc1, x, 0);
34     QueueUserWorkItem(TestProc2, x, WT_EXECUTELONGFUNCTION);
35     QueueUserWorkItem(TestProc3, x, WT_EXECUTEINIOTHREAD);
36     QueueUserWorkItem(TestProc4, x, WT_EXECUTEINIOTHREAD | WT_EXECUTELONGFUNCTION);
37     QueueUserWorkItem(TestProc5, x, WT_EXECUTEINPERSISTENTTHREAD);
38     QueueUserWorkItem(TestProc6, x, WT_EXECUTEINPERSISTENTIOTHREAD);
39     Sleep(INFINITE);
40     return 0;
41 }
42