Skip to content
Snippets Groups Projects
Commit 64a0e7e3 authored by sof's avatar sof
Browse files

[project @ 1998-06-29 17:49:05 by sof]

Added OnExitHook(); hook run after Haskell world has been properly shut down
parent 609e5ea8
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,7 @@ StgFunPtr impossible_jump_after_switch(STG_NO_ARGS);
/* 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);
......
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}
......@@ -204,7 +204,7 @@ P_ PrelGHC_ZcCReturnable_static_info = (P_) 0xbadbadbaL;
/* 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
......@@ -229,7 +229,7 @@ STGFUN(startStgWorld)
/* 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();
......@@ -501,6 +501,26 @@ STATIC_ITBL(STK_STUB_info,STK_STUB_entry,UpdErr,0,INFO_OTHER_TAG,0,0,const,EF_,I
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}
%/****************************************************************
......
......@@ -342,6 +342,11 @@ shutdownHaskell(STG_NO_ARGS)
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment