X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FRtsAPI.h;h=ff2bc1120af74e811cb13ceb2272d7cb70cb5780;hb=e43a5e498520b933a0d9f4c7e9ddfb7ed2032cfd;hp=41f0fc026c502fc4697d25ea11a6eb53e9013b83;hpb=5a5acb3698aa4ffdd738c301fa722afe12a1f3de;p=ghc-hetmet.git diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 41f0fc0..ff2bc11 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -4,6 +4,9 @@ * * API for invoking Haskell functions via the RTS * + * To understand the structure of the RTS headers, see the wiki: + * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes + * * --------------------------------------------------------------------------*/ #ifndef RTSAPI_H @@ -26,7 +29,7 @@ typedef enum { HeapExhausted /* out of memory */ } SchedulerStatus; -typedef StgClosure *HaskellObj; +typedef struct StgClosure_ *HaskellObj; /* * An abstract type representing the token returned by rts_lock() and @@ -66,6 +69,15 @@ Capability *rts_lock (void); // releases the token acquired with rts_lock(). void rts_unlock (Capability *token); +// If you are in a context where you know you have a current capability but +// do not know what it is, then use this to get it. Basically this only +// applies to "unsafe" foreign calls (as unsafe foreign calls are made with +// the capability held). +// +// WARNING: There is *no* guarantee this returns anything sensible (eg NULL) +// when there is no current capability. +Capability *rts_unsafeGetMyCapability (void); + /* ---------------------------------------------------------------------------- Building Haskell objects from C datatypes. ------------------------------------------------------------------------- */