summaryrefslogtreecommitdiff
path: root/includes/RtsAPI.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-11-18 15:44:14 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-04-26 16:00:43 +0100
commite68195a96529cf1cc2d9cc6a9bc05183fce5ecea (patch)
treed79dbffbcb44cbdd7e10706535a66e4d9669378d /includes/RtsAPI.h
parentc9bcaf3165586ac214fa694e61c55eb45eb131ab (diff)
downloadhaskell-e68195a96529cf1cc2d9cc6a9bc05183fce5ecea.tar.gz
RTS: Add setInCallCapability()
This allows an OS thread to specify which capability it should run on when it makes a call into Haskell. It is intended for a fairly specialised use case, when the client wants to have tighter control over the mapping between OS threads and Capabilities - perhaps 1:1 correspondence, for example.
Diffstat (limited to 'includes/RtsAPI.h')
-rw-r--r--includes/RtsAPI.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 4748060dee..16b848678d 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -172,6 +172,15 @@ void rts_unlock (Capability *token);
// when there is no current capability.
Capability *rts_unsafeGetMyCapability (void);
+// Specify the Capability that the current OS thread should run on when it calls
+// into Haskell. The actual capability will be calculated as the supplied
+// value modulo the number of enabled Capabilities.
+//
+// Note that the thread may still be migrated by the RTS scheduler, but that
+// will only happen if there are multiple threads running on one Capability and
+// another Capability is free.
+void setInCallCapability (int preferred_capability);
+
/* ----------------------------------------------------------------------------
Building Haskell objects from C datatypes.
------------------------------------------------------------------------- */