summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorrpj <rpj>1999-11-04 14:56:51 +0000
committerrpj <rpj>1999-11-04 14:56:51 +0000
commitc614567b4940f31a7ce98ceb9eb48b1241b4727a (patch)
treeaaa362d4c46c13f7fb7546b1ee14264e32b22ec1 /misc.c
parentefa438832bc1343c08c334e88aec4266040ddec3 (diff)
Add WinCE patches to snap-1999-05-30-wince-patches branch.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index 208541a..cd9caa1 100644
--- a/misc.c
+++ b/misc.c
@@ -163,6 +163,10 @@ pthread_self (void)
self->thread = GetCurrentThreadId ();
+#ifdef UNDER_CE
+ /* DuplicateHandle does not exist on WinCE */
+ self->threadH = GetCurrentThread();
+#else
if( !DuplicateHandle(
GetCurrentProcess(),
GetCurrentThread(),
@@ -175,6 +179,7 @@ pthread_self (void)
free( self );
return (NULL);
}
+#endif
}
pthread_setspecific (_pthread_selfThreadKey, self);
@@ -314,7 +319,7 @@ CancelableWait (HANDLE waitHandle, DWORD timeout)
DWORD exceptionInformation[3];
- exceptionInformation[0] = (DWORD) (_PTHREAD_EPS_CANCEL);
+ exceptionInformation[0] = (DWORD) (0);
exceptionInformation[1] = (DWORD) (0);
exceptionInformation[2] = (DWORD) (0);
@@ -328,7 +333,7 @@ CancelableWait (HANDLE waitHandle, DWORD timeout)
#ifdef __cplusplus
- throw Pthread_exception_cancel();
+ throw Pthread_exception();
#endif /* __cplusplus */
@@ -361,4 +366,17 @@ pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout)
return (CancelableWait(waitHandle, timeout));
}
-
+#ifdef NEED_CALLOC
+void
+*_pthread_calloc(size_t n, size_t s) {
+ unsigned int m = n*s;
+ void *p;
+
+ p = malloc(m);
+ if (p == NULL) return NULL;
+
+ memset(p, 0, m);
+
+ return p;
+}
+#endif