X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FRtsAPI.h;h=5160046da804ab79449d98c72c6a8ea4b6a33e07;hb=3e64df195685dc6fc42475908a5b33b59543bb57;hp=54fa3ee560f0d5536777a7071471df8b8c310130;hpb=8bac478832e0cf9fa7ad1cfc81c08b0b9f13938e;p=ghc-hetmet.git diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 54fa3ee..5160046 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -22,7 +22,8 @@ typedef enum { NoStatus, /* not finished yet */ Success, /* completed successfully */ Killed, /* uncaught exception */ - Interrupted /* stopped in response to a call to interruptStgRts */ + Interrupted, /* stopped in response to a call to interruptStgRts */ + HeapExhausted /* out of memory */ } SchedulerStatus; typedef StgClosure *HaskellObj; @@ -45,6 +46,10 @@ extern void setProgArgv ( int argc, char *argv[] ); extern void getFullProgArgv ( int *argc, char **argv[] ); extern void setFullProgArgv ( int argc, char *argv[] ); +#ifndef mingw32_HOST_OS +extern void shutdownHaskellAndSignal (int sig); +#endif + /* exit() override */ extern void (*exitFn)(int); @@ -61,6 +66,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. ------------------------------------------------------------------------- */