• Duncan Coutts's avatar
    Add and export rts_unsafeGetMyCapability from rts · 85df606a
    Duncan Coutts authored
    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.
    85df606a
Capability.c 26.9 KB