Commit 3fa80568 authored by sof's avatar sof
Browse files

[project @ 2002-02-12 15:34:25 by sof]

- give rts_n_free_capabilities an interpretation
  in threaded mode (possible values: 0,1)
- noFreeCapabilities() -? noCapabilities()
parent 2cc5b907
......@@ -26,6 +26,8 @@
Capability MainCapability; /* for non-SMP, we have one global capability */
#endif
nat rts_n_free_capabilities;
static
void
initCapability( Capability *cap )
......@@ -64,6 +66,7 @@ static Capability *free_capabilities; /* Available capabilities for running thre
void grabCapability(Capability** cap)
{
#if !defined(SMP)
rts_n_free_capabilities = 0;
*cap = &MainCapability;
#else
*cap = free_capabilities;
......@@ -79,6 +82,7 @@ void releaseCapability(Capability* cap)
free_capabilities = cap;
rts_n_free_capabilities++;
#endif
rts_n_free_capabilities = 1;
return;
}
......
......@@ -32,7 +32,7 @@ extern void initCapabilities(void);
extern void grabCapability(Capability** cap);
extern void releaseCapability(Capability* cap);
#if defined(SMP)
#if defined(RTS_SUPPORTS_THREADS)
extern nat rts_n_free_capabilities; /* total number of available capabilities */
static inline nat getFreeCapabilities()
......@@ -40,16 +40,20 @@ static inline nat getFreeCapabilities()
return rts_n_free_capabilities;
}
static inline rtsBool noFreeCapabilities()
static inline rtsBool noCapabilities()
{
return (rts_n_free_capabilities == 0);
}
static inline rtsBool allFreeCapabilities()
{
# if defined(SMP)
return (rts_n_free_capabilities == RtsFlags.ParFlags.nNodes);
# else
return (rts_n_free_capabilities == 1);
# endif
}
#endif /* SMP */
#endif /* RTS_SUPPORTS_THREADS */
#endif /* __CAPABILITY_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment