Commit 887c035b authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

- Added, cleaned up and/or documentated _{begin,end}thread{,ex}.

- _lfind and _ltow are implemented (not stubs).
parent 6ac11083
......@@ -173,7 +173,7 @@ debug_channels (msvcrt)
@ stub _atoi64 #(str)
@ stub _atoldbl
@ cdecl _beep(long long) _beep
@ stub _beginthread #(ptr long ptr)
@ cdecl _beginthread (ptr long ptr) _beginthread
@ cdecl _beginthreadex (ptr long ptr ptr long ptr) _beginthreadex
@ cdecl _c_exit() MSVCRT__c_exit
@ cdecl _cabs(long) _cabs
......@@ -204,7 +204,7 @@ debug_channels (msvcrt)
@ stub _dup #(long)
@ stub _dup2 #(long long)
@ cdecl _ecvt( double long ptr ptr) ecvt
@ stub _endthread #()
@ cdecl _endthread () _endthread
@ cdecl _endthreadex(long) _endthreadex
@ extern _environ MSVCRT__environ
@ cdecl _eof(long) _eof
......@@ -322,7 +322,7 @@ debug_channels (msvcrt)
@ cdecl _j1(double) j1
@ cdecl _jn(long double) jn
@ cdecl _kbhit() _kbhit
@ stub _lfind
@ cdecl _lfind(ptr ptr ptr long ptr) _lfind
@ cdecl _loaddll(str) _loaddll
@ cdecl _local_unwind2(ptr long) _local_unwind2
@ stub _lock
......@@ -335,7 +335,7 @@ debug_channels (msvcrt)
@ cdecl _lseek(long long long) _lseek
@ stub _lseeki64 #(long long long)
@ forward -noimport _ltoa ntdll._ltoa
@ stub _ltow #(long)
@ cdecl _ltow(long ptr long) _ltow
@ cdecl _makepath(str str str str str) _makepath
@ cdecl _matherr(ptr) _matherr
@ cdecl _mbbtombc(long) _mbbtombc
......
......@@ -9,27 +9,79 @@
DEFAULT_DEBUG_CHANNEL(msvcrt);
/********************************************************************/
typedef struct {
_beginthread_start_routine_t start_address;
void *arglist;
} _beginthread_trampoline_t;
/*********************************************************************
* _beginthread_trampoline
*/
static DWORD CALLBACK _beginthread_trampoline(LPVOID arg)
{
_beginthread_trampoline_t *trampoline = arg;
trampoline->start_address(trampoline->arglist);
return 0;
}
/*********************************************************************
* _beginthread (MSVCRT.@)
*/
unsigned long _beginthread(
_beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
unsigned int stack_size, /* [in] Stack size for new thread or 0 */
void *arglist) /* [in] Argument list to be passed to new thread or NULL */
{
_beginthread_trampoline_t trampoline;
TRACE("(%p, %d, %p)\n", start_address, stack_size, arglist);
trampoline.start_address = start_address;
trampoline.arglist = arglist;
/* FIXME */
return CreateThread(NULL, stack_size, _beginthread_trampoline, &trampoline, 0, NULL);
}
/*********************************************************************
* _beginthreadex (MSVCRT.@)
*/
unsigned long _beginthreadex(void* sec,
unsigned int stack,
unsigned __stdcall (*start)(void*),
void* arg, unsigned int flag,
unsigned int* addr)
unsigned long _beginthreadex(
void *security, /* [in] Security descriptor for new thread; must be NULL for Windows 9x applications */
unsigned int stack_size, /* [in] Stack size for new thread or 0 */
_beginthreadex_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
void *arglist, /* [in] Argument list to be passed to new thread or NULL */
unsigned int initflag, /* [in] Initial state of new thread (0 for running or CREATE_SUSPEND for suspended) */
unsigned int *thrdaddr) /* [out] Points to a 32-bit variable that receives the thread identifier */
{
TRACE("(%p, %d, %p, %p, %d, %p)\n", security, stack_size, start_address, arglist, initflag, thrdaddr);
/* FIXME */
return CreateThread(security, stack_size, (LPTHREAD_START_ROUTINE) start_address,
arglist, initflag, (LPDWORD) thrdaddr);
}
/*********************************************************************
* _endthread (MSVCRT.@)
*/
void _endthread(void)
{
TRACE("(%p,%d,%p,%p,%d,%p)\n",sec, stack,start, arg,flag,addr);
TRACE("(void)\n");
/* FIXME */
return CreateThread( sec, stack, (LPTHREAD_START_ROUTINE)start, arg,flag,(LPDWORD)addr);
ExitThread(0);
}
/*********************************************************************
* _endthreadex (MSVCRT.@)
*/
void _endthreadex(unsigned int retval)
void _endthreadex(
unsigned int retval) /* [in] Thread exit code */
{
TRACE("(%d)\n",retval);
TRACE("(%d)\n", retval);
/* FIXME */
ExitThread(retval);
}
......
......@@ -32,11 +32,14 @@
extern "C" {
#endif
unsigned long _beginthread(void (*)(void*),unsigned,void*);
unsigned long _beginthreadex(void*,unsigned,unsigned __stdcall (*)(void*),void*,unsigned, unsigned*);
typedef void __cdecl (*_beginthread_start_routine_t)(void *);
typedef unsigned int __stdcall (*_beginthreadex_start_routine_t)(void *);
unsigned long _beginthread(_beginthread_start_routine_t,unsigned int,void*);
unsigned long _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
int _cwait(int*,int,int);
void _endthread(void);
void _endthreadex(unsigned);
void _endthreadex(unsigned int);
int _execl(const char*,const char*,...);
int _execle(const char*,const char*,...);
int _execlp(const char*,const char*,...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment