[project @ 2005-03-05 13:54:36 by panne]
[ghc-hetmet.git] / ghc / rts / OSThreads.c
index 06b905a..7ed6fd8 100644 (file)
@@ -144,7 +144,7 @@ initCondition( Condition* pCond )
                          NULL); /* unnamed => process-local. */
   
   if ( h == NULL ) {
-    belch("initCondition: unable to create");
+    errorBelch("initCondition: unable to create");
   }
   *pCond = h;
   return;
@@ -154,7 +154,7 @@ void
 closeCondition( Condition* pCond )
 {
   if ( CloseHandle(*pCond) == 0 ) {
-    belch("closeCondition: failed to close");
+    errorBelch("closeCondition: failed to close");
   }
   return;
 }
@@ -169,17 +169,19 @@ broadcastCondition ( Condition* pCond )
 rtsBool
 signalCondition ( Condition* pCond )
 {
-  SetEvent(*pCond);
-  return rtsTrue;
+    if (SetEvent(*pCond) == 0) {
+       barf("SetEvent: %d", GetLastError());
+    }
+    return rtsTrue;
 }
 
 rtsBool
 waitCondition ( Condition* pCond, Mutex* pMut )
 {
-  ReleaseMutex(*pMut);
+  RELEASE_LOCK(pMut);
   WaitForSingleObject(*pCond, INFINITE);
   /* Hmm..use WaitForMultipleObjects() ? */
-  WaitForSingleObject(*pMut, INFINITE);
+  ACQUIRE_LOCK(pMut);
   return rtsTrue;
 }
 
@@ -259,7 +261,7 @@ forkOS_createThread ( HsStablePtr entry )
 #else /* !defined(RTS_SUPPORTS_THREADS) */
 
 int
-forkOS_createThread ( HsStablePtr entry )
+forkOS_createThread ( HsStablePtr entry STG_UNUSED )
 {
     return -1;
 }