diff options
author | Duncan Coutts <duncan@well-typed.com> | 2011-05-26 15:08:43 +0100 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2011-05-26 18:47:38 +0100 |
commit | 68b76e0e49d4d95e1bfe9343697e2abc99470791 (patch) | |
tree | ee7ad40c51594063d45e2dddc0ac3c9655d9fc72 /rts/Capability.h | |
parent | cb2d37da5792b13f5988049f67a24263b4de4ff2 (diff) | |
download | haskell-68b76e0e49d4d95e1bfe9343697e2abc99470791.tar.gz |
Rearrange shutdownCapability code slightly
This is mostly for the beneift of having sensible places to put tracing
code later. We want a code path that has somewhere to trace (in order):
(1) starting up all capabilities;
(2) N * starting up an individual capability;
(3) N * shutting down an individual capability;
(4) shutting down all capabilities.
This has to work in both threaded and non-threaded modes.
Locations (1) and (2) are provided by initCapabilities and
initCapability respectively. Previously, there was no loccation for (4)
and while shutdownCapability should be usable for (3) it was only called
in the !THREADED_RTS case.
Now, shutdownCapability is called unconditionally (and the body is
conditonal on THREADED_RTS) and there is a new shutdownCapabilities that
calls shutdownCapability in a loop.
Diffstat (limited to 'rts/Capability.h')
-rw-r--r-- | rts/Capability.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/rts/Capability.h b/rts/Capability.h index d580a8383d..d380af9cff 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -240,11 +240,6 @@ void prodCapability (Capability *cap, Task *task); // void prodAllCapabilities (void); -// Waits for a capability to drain of runnable threads and workers, -// and then acquires it. Used at shutdown time. -// -void shutdownCapability (Capability *cap, Task *task, rtsBool wait_foreign); - // Attempt to gain control of a Capability if it is free. // rtsBool tryGrabCapability (Capability *cap, Task *task); @@ -270,6 +265,15 @@ extern void grabCapability (Capability **pCap); #endif /* !THREADED_RTS */ +// Waits for a capability to drain of runnable threads and workers, +// and then acquires it. Used at shutdown time. +// +void shutdownCapability (Capability *cap, Task *task, rtsBool wait_foreign); + +// Shut down all capabilities. +// +void shutdownCapabilities(Task *task, rtsBool wait_foreign); + // cause all capabilities to context switch as soon as possible. void setContextSwitches(void); INLINE_HEADER void contextSwitchCapability(Capability *cap); |