summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarin%meer.net <devnull@localhost>2003-11-18 09:46:37 +0000
committerdarin%meer.net <devnull@localhost>2003-11-18 09:46:37 +0000
commita58f9d655e9218246dce60269fbf38a3510ce800 (patch)
tree053ed89b6d5e181e6a6bfcfd732293fcdb0ef637
parent3473e3827477d4477c9c2cfc0da30030e0929e6d (diff)
downloadnspr-hg-a58f9d655e9218246dce60269fbf38a3510ce800.tar.gz
fixes bug 216021 "chekesp error if i link against a msvcrt that is built with strict calling rules" patch=wtc r=darinTHUNDERBIRD_M3_BASE
-rw-r--r--config/prdepend.h1
-rw-r--r--pr/include/md/_win95.h3
-rw-r--r--pr/include/md/_winnt.h3
-rw-r--r--pr/src/md/windows/ntthread.c21
-rw-r--r--pr/src/md/windows/w95thred.c15
5 files changed, 26 insertions, 17 deletions
diff --git a/config/prdepend.h b/config/prdepend.h
index 28c1b139..8bebd56b 100644
--- a/config/prdepend.h
+++ b/config/prdepend.h
@@ -39,4 +39,3 @@
*/
#error "Do not include this header file."
-
diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h
index 3a71acf6..44f3e531 100644
--- a/pr/include/md/_win95.h
+++ b/pr/include/md/_win95.h
@@ -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 {
diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h
index 6dcc991b..1e7fe6d3 100644
--- a/pr/include/md/_winnt.h
+++ b/pr/include/md/_winnt.h
@@ -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 {
diff --git a/pr/src/md/windows/ntthread.c b/pr/src/md/windows/ntthread.c
index a414e5c7..0e7ef6e0 100644
--- a/pr/src/md/windows/ntthread.c
+++ b/pr/src/md/windows/ntthread.c
@@ -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();
diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c
index f8a70043..f2519f42 100644
--- a/pr/src/md/windows/w95thred.c
+++ b/pr/src/md/windows/w95thred.c
@@ -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));