[project @ 2004-08-13 10:45:16 by simonmar]
[ghc-hetmet.git] / ghc / rts / Capability.c
index 18ef4df..3ea96fe 100644 (file)
@@ -137,6 +137,9 @@ static Capability *returning_capabilities;
    threaded RTS, clients must use waitFor*Capability()).
    ------------------------------------------------------------------------- */
 
+#if defined(RTS_SUPPORTS_THREADS)
+static
+#endif
 void
 grabCapability( Capability** cap )
 {
@@ -152,7 +155,9 @@ grabCapability( Capability** cap )
   free_capabilities = (*cap)->link;
   rts_n_free_capabilities--;
 #endif
+#if defined(RTS_SUPPORTS_THREADS)
   IF_DEBUG(scheduler, sched_belch("worker: got capability"));
+#endif
 }
 
 /* ----------------------------------------------------------------------------
@@ -206,7 +211,9 @@ releaseCapability( Capability* cap UNUSED_IF_NOT_SMP )
        rts_n_free_capabilities = 1;
 #endif
        // Signal that a capability is available
-       signalCondition(&thread_ready_cond);
+       if (rts_n_waiting_tasks > 0) {
+           signalCondition(&thread_ready_cond);
+       }
        startSchedulerTaskIfNecessary();
        IF_DEBUG(scheduler, sched_belch("worker: released capability"));
     }