summaryrefslogtreecommitdiff
path: root/threadproc/win32/thread.c
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-12 01:24:12 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2002-02-12 01:24:12 +0000
commit3e0b4a50bdc7c883767d65bd7258ee9be02e02d0 (patch)
tree17426d9dd942b54d78c04be092a099c956032c54 /threadproc/win32/thread.c
parent48907799486116054373e6992429e6a808e4d3e3 (diff)
downloadlibapr-3e0b4a50bdc7c883767d65bd7258ee9be02e02d0.tar.gz
Another fine patch from Mladen Turk <mturk@mappingsoft.com>, since WinCE
doesn't use the same clib conventions as the rest of the Win32 platforms, we can't protect the clib space with the _beginthreadex/_endthread conventions - fall back on the native API. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/win32/thread.c')
-rw-r--r--threadproc/win32/thread.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c
index 2b9c85090..f7af49985 100644
--- a/threadproc/win32/thread.c
+++ b/threadproc/win32/thread.c
@@ -58,7 +58,9 @@
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_portable.h"
+#if APR_HAVE_PROCESS_H
#include <process.h>
+#endif
#include "misc.h"
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
@@ -121,12 +123,19 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
/* Use 0 for Thread Stack Size, because that will default the stack to the
* same size as the calling thread.
*/
+#ifndef _WIN32_WCE
if (((*new)->td = (HANDLE *)_beginthreadex(NULL, 0,
(unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
(*new), 0, &temp)) == 0) {
return APR_FROM_OS_ERROR(_doserrno);
}
-
+#else
+ if (((*new)->td = (HANDLE *)CreateThread(NULL, 0,
+ (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
+ (*new), 0, &temp)) == 0) {
+ return apr_get_os_error();
+ }
+#endif
if (attr && attr->detach) {
CloseHandle((*new)->td);
}
@@ -139,8 +148,12 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
{
thd->exitval = retval;
apr_pool_destroy(thd->cntxt);
+#ifndef _WIN32_WCE
_endthreadex(0);
- return APR_SUCCESS;
+#else
+ ExitThread(0);
+#endif
+ return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
@@ -174,9 +187,11 @@ APR_DECLARE(void) apr_thread_yield()
* providing more critical threads a bit larger timeslice)
* we won't worry too much if it's not available.
*/
+#ifndef _WIN32_WCE
if (apr_os_level >= APR_WIN_NT) {
SwitchToThread();
}
+#endif
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,