[project @ 2002-02-14 09:00:41 by sof]
authorsof <unknown>
Thu, 14 Feb 2002 09:00:41 +0000 (09:00 +0000)
committersof <unknown>
Thu, 14 Feb 2002 09:00:41 +0000 (09:00 +0000)
make multi-threading story work under win32 also

ghc/rts/OSThreads.c

index a0d3ca8..abfa583 100644 (file)
@@ -112,8 +112,8 @@ void
 initCondition( Condition* pCond )
 {
   HANDLE h =  CreateEvent(NULL, 
-                         TRUE,  /* manual reset */
-                         TRUE,  /* initially signalled */
+                         FALSE,  /* auto reset */
+                         FALSE,  /* initially not signalled */
                          NULL); /* unnamed => process-local. */
   
   if ( h == NULL ) {
@@ -157,6 +157,13 @@ waitCondition ( Condition* pCond, Mutex* pMut )
 }
 
 void
+yieldThread()
+{
+  Sleep(0);
+  return;
+}
+
+void
 shutdownThread()
 {
   _endthreadex(0);
@@ -174,12 +181,12 @@ int
 createOSThread ( OSThreadId* pId, void (*startProc)(void))
 {
   
-  return _beginthreadex ( NULL,  /* default security attributes */
-                         0,
-                         startProcWrapper,
-                         (void*)startProc,
-                         0,
-                         (unsigned*)pId);
+  return (_beginthreadex ( NULL,  /* default security attributes */
+                          0,
+                          startProcWrapper,
+                          (void*)startProc,
+                          0,
+                          (unsigned*)pId) == NULL);
 }
 
 OSThreadId