/* hooks: user might write some of their own */
void ErrorHdrHook PROTO((FILE *));
void OutOfHeapHook PROTO((W_, W_));
+void OnExitHook (STG_NO_ARGS);
void StackOverflowHook PROTO((I_));
#ifdef CONCURRENT
int NoRunnableThreadsHook (STG_NO_ARGS);
--- /dev/null
+
+Note: by the time this hook has been called, Haskell land
+will have been shut down completely.
+
+ToDo: feed the hook info on whether we're shutting down as a result
+of termination or run-time error ?
+
+\begin{code}
+#include "rtsdefs.h"
+
+void
+OnExitHook ()
+{
+ return;
+}
+\end{code}
/* the IoWorld token to start the whole thing off */
/* Question: this is just an amusing hex code isn't it
-- or does it mean something? ADR */
-P_ realWorldZh_closure = (P_) 0xbadbadbaL;
+P_ realWorldZh_closure = (P_)0xbadbadbaL;
#ifndef CONCURRENT
/* Put an IoWorld token on the A stack */
SpB -= BREL(1);
- *SpB = (P_) realWorldZh_closure;
+ (P_)*SpB = (P_) realWorldZh_closure;
Node = (P_) TopClosure; /* Point to the closure for main/errorIO-arg */
ENT_VIA_NODE();
SET_STATIC_HDR(STK_STUB_closure,STK_STUB_info,CC_SUBSUMED,,EXTDATA_RO)
, (W_)0, (W_)0
};
+
+
+ED_RO_(vtbl_seq);
+
+/*
+STGFUN(seqZhCode)
+{
+ FB_
+ __label__ cont;
+ SpB[BREL(0)] = (W_) RetReg;
+ SpB[BREL(1)] = (W_) &&cont;
+ RetReg = (StgRetAddr) vtbl_seq;
+ ENT_VIA_NODE();
+ InfoPtr = (D_)(INFO_PTR(Node));
+ JMP_(ENTRY_CODE(InfoPtr));
+cont:
+ FE_
+}
+*/
+
\end{code}
%/****************************************************************
if (RTSflags.TickyFlags.showTickyStats) PrintTickyInfo();
#endif
+ /* Give the application a chance to do something sensible
+ on-exit
+ */
+ OnExitHook();
+
fflush(stdout);
/* This fflush is important, because: if "main" just returns,
then we will end up in pre-supplied exit code that will close