#ifndef __CAPABILITY_H__
#define __CAPABILITY_H__
-#if !defined(SMP)
-extern Capability MainCapability;
-#endif
+// All the capabilities
+extern Capability *capabilities;
// Initialised the available capabilities.
//
//
extern void releaseCapability( Capability* cap );
+// Signal that a thread has become runnable
+//
+extern void threadRunnable ( void );
+
+extern void prodWorker ( void );
+
#ifdef RTS_SUPPORTS_THREADS
// Gives up the current capability IFF there is a higher-priority
// thread waiting for it. This happens in one of two ways:
extern void passCapabilityToWorker( void );
extern nat rts_n_free_capabilities;
+
+extern Capability *free_capabilities;
+
/* number of worker threads waiting for a return capability
*/
extern nat rts_n_waiting_workers;
static inline rtsBool allFreeCapabilities (void)
{
+#if defined(SMP)
+ return (rts_n_free_capabilities == RTS_DEREF(RtsFlags).ParFlags.nNodes);
+#else
return (rts_n_free_capabilities == 1);
+#endif
}
#else // !RTS_SUPPORTS_THREADS
//
extern void grabCapability( Capability **pCap );
-#endif // !RTS_SUPPORTS_THREADS
+#endif /* !RTS_SUPPORTS_THREADS */
#endif /* __CAPABILITY_H__ */