Add and export rts_unsafeGetMyCapability from rts
authorDuncan Coutts <duncan@well-typed.com>
Fri, 12 Jun 2009 11:41:56 +0000 (11:41 +0000)
committerDuncan Coutts <duncan@well-typed.com>
Fri, 12 Jun 2009 11:41:56 +0000 (11:41 +0000)
commit85df606a23117641682e19f3851099134e5f77a4
tree6eee4ab0b86a7ba96aece61bb16e1abc409a4e56
parentf5c113de54455bc1320da4674c70e17598832533
Add and export rts_unsafeGetMyCapability from rts
We need this, or something equivalent, to be able to implement
stgAllocForGMP outside of the rts. That's because we want to use
allocateLocal which allocates from the given capability without
having to take any locks. In the gmp primops we're basically in
an unsafe foreign call, that is a context where we hold a current
capability. So it's safe for us to use allocateLocal. We just
need a way to get the current capability. The method to get the
current capability varies depends on whether we're using the
threaded rts or not. When stgAllocForGMP is built inside the rts
that's ok because we can do it conditionally on THREADED_RTS.
Outside the rts we need a single api we can call without knowing
if we're talking to a threaded rts or not, hence this addition.
includes/RtsAPI.h
rts/Capability.c
rts/Linker.c