From d1a47b329fd21ab5a7db1dbe47959a874e8648e6 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Sat, 3 Jul 1999 18:39:41 +0000 Subject: [PATCH] [project @ 1999-07-03 18:39:40 by sof] New RTS entry point, shutdownHaskellAndExit(), which does what the name implies - used when you want to exit from within Haskell code (e.g., System.exitWith.) --- ghc/includes/RtsAPI.h | 3 ++- ghc/includes/SchedAPI.h | 12 +++++++++++- ghc/rts/RtsStartup.c | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ghc/includes/RtsAPI.h b/ghc/includes/RtsAPI.h index bbea2cb4f8ec..33da457de748 100644 --- a/ghc/includes/RtsAPI.h +++ b/ghc/includes/RtsAPI.h @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: RtsAPI.h,v 1.5 1999/05/21 14:46:20 sof Exp $ + * $Id: RtsAPI.h,v 1.6 1999/07/03 18:39:41 sof Exp $ * * (c) The GHC Team, 1998-1999 * @@ -19,6 +19,7 @@ typedef StgClosure *HaskellObj; ------------------------------------------------------------------------- */ extern void startupHaskell ( int argc, char *argv[] ); extern void shutdownHaskell ( void ); +extern void shutdownHaskellAndExit ( int exitCode ); /* ---------------------------------------------------------------------------- Building Haskell objects from C datatypes. diff --git a/ghc/includes/SchedAPI.h b/ghc/includes/SchedAPI.h index 014f906e3440..4c0d0ab2bfee 100644 --- a/ghc/includes/SchedAPI.h +++ b/ghc/includes/SchedAPI.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: SchedAPI.h,v 1.4 1999/06/03 08:09:31 sof Exp $ + * $Id: SchedAPI.h,v 1.5 1999/07/03 18:39:41 sof Exp $ * * (c) The GHC Team 1998 * @@ -23,6 +23,15 @@ typedef enum { AllBlocked, /* subtly different from Deadlock */ } SchedulerStatus; + +/* + * schedule() plus the thread creation functions are not part + * part of the external RTS API, so leave them out if we're + * not compiling rts/ bits. -- sof 7/99 + * + */ +#ifdef COMPILING_RTS + SchedulerStatus schedule(StgTSO *main_thread, /*out*/StgClosure **ret); /* @@ -83,5 +92,6 @@ void deleteThread(StgTSO *tso); */ void RevertCAFs(void); +#endif #endif diff --git a/ghc/rts/RtsStartup.c b/ghc/rts/RtsStartup.c index aa84c0b85b54..1c50c08c4a69 100644 --- a/ghc/rts/RtsStartup.c +++ b/ghc/rts/RtsStartup.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsStartup.c,v 1.15 1999/07/02 09:31:54 simonmar Exp $ + * $Id: RtsStartup.c,v 1.16 1999/07/03 18:39:40 sof Exp $ * * (c) The GHC Team, 1998-1999 * @@ -139,6 +139,19 @@ startupHaskell(int argc, char *argv[]) end_init(); } +/* + * Shutting down the RTS - two ways of doing this, one which + * calls exit(), one that doesn't. + * + * (shutdownHaskellAndExit() is called by System.exitWith). + */ +void +shutdownHaskellAndExit(int n) +{ + shutdownHaskell(); + stg_exit(n); +} + void shutdownHaskell(void) { -- GitLab