Removed some unnecessary includes.
[wine] / dlls / msvcrt / thread.c
1 /*
2  * msvcrt.dll thread functions
3  *
4  * Copyright 2000 Jon Griffiths
5  */
6 #include "msvcrt.h"
7
8 #include "msvcrt/process.h"
9
10 DEFAULT_DEBUG_CHANNEL(msvcrt);
11
12 /********************************************************************/
13
14 typedef struct {
15   _beginthread_start_routine_t start_address;
16   void *arglist;
17 } _beginthread_trampoline_t;
18
19 /*********************************************************************
20  *              _beginthread_trampoline
21  */
22 static DWORD CALLBACK _beginthread_trampoline(LPVOID arg)
23 {
24   _beginthread_trampoline_t *trampoline = arg;
25   trampoline->start_address(trampoline->arglist);
26   return 0;
27 }
28
29 /*********************************************************************
30  *              _beginthread (MSVCRT.@)
31  */
32 unsigned long _beginthread(
33   _beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
34   unsigned int stack_size, /* [in] Stack size for new thread or 0 */
35   void *arglist)           /* [in] Argument list to be passed to new thread or NULL */
36 {
37   _beginthread_trampoline_t trampoline;
38
39   TRACE("(%p, %d, %p)\n", start_address, stack_size, arglist);
40
41   trampoline.start_address = start_address;
42   trampoline.arglist = arglist;
43
44   /* FIXME */
45   return CreateThread(NULL, stack_size, _beginthread_trampoline, &trampoline, 0, NULL);
46 }
47
48 /*********************************************************************
49  *              _beginthreadex (MSVCRT.@)
50  */
51 unsigned long _beginthreadex(
52   void *security,          /* [in] Security descriptor for new thread; must be NULL for Windows 9x applications */
53   unsigned int stack_size, /* [in] Stack size for new thread or 0 */
54   _beginthreadex_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
55   void *arglist,           /* [in] Argument list to be passed to new thread or NULL */
56   unsigned int initflag,   /* [in] Initial state of new thread (0 for running or CREATE_SUSPEND for suspended) */
57   unsigned int *thrdaddr)  /* [out] Points to a 32-bit variable that receives the thread identifier */
58 {
59   TRACE("(%p, %d, %p, %p, %d, %p)\n", security, stack_size, start_address, arglist, initflag, thrdaddr);
60
61   /* FIXME */
62   return CreateThread(security, stack_size, (LPTHREAD_START_ROUTINE) start_address,
63                       arglist, initflag, (LPDWORD) thrdaddr);
64 }
65
66 /*********************************************************************
67  *              _endthread (MSVCRT.@)
68  */
69 void _endthread(void)
70 {
71   TRACE("(void)\n");
72
73   /* FIXME */
74   ExitThread(0);
75 }
76
77 /*********************************************************************
78  *              _endthreadex (MSVCRT.@)
79  */
80 void _endthreadex(
81   unsigned int retval) /* [in] Thread exit code */
82 {
83   TRACE("(%d)\n", retval);
84
85   /* FIXME */
86   ExitThread(retval);
87 }
88