[project @ 2003-01-25 15:54:48 by wolfgang]
[ghc-hetmet.git] / ghc / includes / RtsAPI.h
index 7672dc6..32e7362 100644 (file)
@@ -1,5 +1,5 @@
 /* ----------------------------------------------------------------------------
- * $Id: RtsAPI.h,v 1.26 2002/02/15 07:23:02 sof Exp $
+ * $Id: RtsAPI.h,v 1.31 2003/01/25 15:54:48 wolfgang Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -38,6 +38,20 @@ extern void shutdownHaskellAndExit ( int exitCode );
 extern void setProgArgv            ( int argc, char *argv[] );
 extern void getProgArgv            ( int *argc, char **argv[] );
 
+
+/* ----------------------------------------------------------------------------
+   Locking.
+   
+   In a multithreaded environments, you have to surround all access to the
+   RtsAPI with these calls.
+   ------------------------------------------------------------------------- */
+   
+void
+rts_lock ( void );
+
+void
+rts_unlock ( void );
+
 /* ----------------------------------------------------------------------------
    Building Haskell objects from C datatypes.
    ------------------------------------------------------------------------- */
@@ -61,9 +75,6 @@ HaskellObj   rts_mkString     ( char    *s );
 
 HaskellObj   rts_apply        ( HaskellObj, HaskellObj );
 
-/* DEPRECATED (use rts_mkPtr): */
-HaskellObj   rts_mkAddr       ( HsAddr   a );
-
 /* ----------------------------------------------------------------------------
    Deconstructing Haskell objects
    ------------------------------------------------------------------------- */
@@ -84,13 +95,12 @@ HsDouble     rts_getDouble    ( HaskellObj );
 HsStablePtr  rts_getStablePtr ( HaskellObj );
 HsBool       rts_getBool      ( HaskellObj );
 
-/* DEPRECATED (use rts_getPtr): */
-HsAddr       rts_getAddr      ( HaskellObj );
-
 /* ----------------------------------------------------------------------------
    Evaluating Haskell expressions
 
    The versions ending in '_' allow you to specify an initial stack size.
+   Note that these calls may cause Garbage Collection, so all HaskellObj
+   references are rendered invalid by these calls.
    ------------------------------------------------------------------------- */
 SchedulerStatus 
 rts_eval ( HaskellObj p, /*out*/HaskellObj *ret );
@@ -116,7 +126,18 @@ rts_evalLazyIO ( HaskellObj p, unsigned int stack_size, /*out*/HaskellObj *ret )
 void
 rts_checkSchedStatus ( char* site, SchedulerStatus rc);
 
-/* -------------------------------------------------------------------------- */
+/* --------------------------------------------------------------------------
+   Wrapper closures
+
+   These are used by foreign export and foreign import "wrapper" stubs.
+   ----------------------------------------------------------------------- */
+
+extern StgClosure GHCziTopHandler_runIO_closure;
+extern StgClosure GHCziTopHandler_runNonIO_closure;
+#define runIO_closure            (&GHCziTopHandler_runIO_closure)
+#define runNonIO_closure         (&GHCziTopHandler_runNonIO_closure)
+
+/* ------------------------------------------------------------------------ */
 
 #ifdef __cplusplus
 }