X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FRtsAPI.h;h=2d2c35ca979691c340de4e52be358d43f15f8408;hb=431453c003b867a2fe33d8634ee830d062be5a96;hp=1b6678905997cade16147a5dca9ac737c305eec6;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 1b66789..2d2c35c 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -22,10 +22,11 @@ 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; +typedef struct StgClosure_ *HaskellObj; /* * An abstract type representing the token returned by rts_lock() and @@ -42,7 +43,15 @@ extern void shutdownHaskell ( void ); extern void shutdownHaskellAndExit ( int exitCode ); extern void getProgArgv ( int *argc, char **argv[] ); 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); /* ---------------------------------------------------------------------------- Locking. @@ -57,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. ------------------------------------------------------------------------- */ @@ -141,10 +159,10 @@ rts_getSchedStatus (Capability *cap); These are used by foreign export and foreign import "wrapper" stubs. ----------------------------------------------------------------------- */ -extern StgWord GHCziTopHandler_runIO_closure[]; -extern StgWord GHCziTopHandler_runNonIO_closure[]; -#define runIO_closure GHCziTopHandler_runIO_closure -#define runNonIO_closure GHCziTopHandler_runNonIO_closure +extern StgWord base_GHCziTopHandler_runIO_closure[]; +extern StgWord base_GHCziTopHandler_runNonIO_closure[]; +#define runIO_closure base_GHCziTopHandler_runIO_closure +#define runNonIO_closure base_GHCziTopHandler_runNonIO_closure /* ------------------------------------------------------------------------ */