fixes bug 216021 "chekesp error if i link against a msvcrt that is built with strict calling rules" patch=wtc r=darin

git-svn-id: svn://10.0.0.236/trunk@149490 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net 2003-11-18 09:49:40 +00:00
parent 26ab006b91
commit fd25d21244
5 changed files with 26 additions and 17 deletions

View File

@ -39,4 +39,3 @@
*/
#error "Do not include this header file."

View File

@ -112,6 +112,9 @@ struct _MDThread {
struct PRThread *prev, *next; /* used by the cvar wait queue to
* chain the PRThread structures
* together */
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
* pass its 'start' argument to
* pr_root. */
};
struct _MDThreadStack {

View File

@ -172,6 +172,9 @@ struct _MDThread {
void *fiber_arg; /* arg to main fiber routine */
PRUint32 fiber_stacksize; /* stacksize for fiber */
PRInt32 fiber_last_error; /* last error for the fiber */
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
* pass its 'start' argument to
* pr_root. */
};
struct _MDThreadStack {

View File

@ -191,6 +191,14 @@ _PR_MD_INIT_THREAD(PRThread *thread)
return PR_SUCCESS;
}
static unsigned __stdcall
pr_root(void *arg)
{
PRThread *thread = (PRThread *)arg;
thread->md.start(thread);
return 0;
}
PRStatus
_PR_MD_CREATE_THREAD(PRThread *thread,
void (*start)(void *),
@ -200,23 +208,14 @@ _PR_MD_CREATE_THREAD(PRThread *thread,
PRUint32 stackSize)
{
#if 0
thread->md.handle = CreateThread(
NULL, /* security attrib */
thread->stack->stackSize, /* stack size */
(LPTHREAD_START_ROUTINE)start, /* startup routine */
(void *)thread, /* thread param */
CREATE_SUSPENDED, /* create flags */
&(thread->id) ); /* thread id */
#else
thread->md.start = start;
thread->md.handle = (HANDLE) _beginthreadex(
NULL,
thread->stack->stackSize,
(unsigned (__stdcall *)(void *))start,
pr_root,
(void *)thread,
CREATE_SUSPENDED,
&(thread->id));
#endif
if(!thread->md.handle) {
PRErrorCode prerror;
thread->md.fiber_last_error = GetLastError();

View File

@ -106,6 +106,14 @@ _PR_MD_INIT_THREAD(PRThread *thread)
return PR_SUCCESS;
}
static unsigned __stdcall
pr_root(void *arg)
{
PRThread *thread = (PRThread *)arg;
thread->md.start(thread);
return 0;
}
PRStatus
_PR_MD_CREATE_THREAD(PRThread *thread,
void (*start)(void *),
@ -115,14 +123,11 @@ _PR_MD_CREATE_THREAD(PRThread *thread,
PRUint32 stackSize)
{
thread->md.start = start;
thread->md.handle = (HANDLE) _beginthreadex(
NULL,
thread->stack->stackSize,
#if defined(__MINGW32__)
(void *)start,
#else
(unsigned (__stdcall *)(void *))start,
#endif
pr_root,
(void *)thread,
CREATE_SUSPENDED,
&(thread->id));