No subject


Sun Oct 23 10:51:38 CEST 2011


>
> "When the interrupt signal is received, the default behaviour of the
> runtime is to attempt to shut down the Haskell program gracefully. It does
> this by calling interruptStgRts() in rts/Schedule.c<http://hackage.haskell.org/trac/ghc/browser/rts/Schedule.c>
>  (see Commentary/Rts/Scheduler#ShuttingDown<http://hackage.haskell.org/trac/ghc/wiki/Commentary/Rts/Scheduler#ShuttingDown>).
> If a second interrupt signal is received, then we terminate the process
> immediately; this is just in case the normal shutdown procedure failed or
> hung for some reason, the user is always able to stop the process with two
> control-C keystrokes"
>

On further thought, there is something sensible here: the RTS might crash
while trying to exit.  I propose, for POSIX environments, the following
change to SIGINT handling:

* SIGINT is transformed into UserInterrupt during normal program execution
* Once the RTS is committed to exiting, it resets the signal handler for
SIGINT so that any additional control-c causes an immediate exit

Makes sense?

Brian

--bcaec520eacb07ce1604b075a34d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Sat, Oct 29, 2011 at 12:18 PM, Brian Johnson <span dir=3D"ltr">&lt;<a hr=
ef=3D"mailto:brianjohnsonhaskellcafe at gmail.com">brianjohnsonhaskellcafe at gma=
il.com</a>&gt;</span> wrote:<div><br><div class=3D"gmail_quote"><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex;">
<div class=3D"im"><span class=3D"Apple-style-span" style=3D"font-family: ar=
ial, helvetica, sans-serif; ">From <a href=3D"http://hackage.haskell.org/tr=
ac/ghc/wiki/Commentary/Rts/Signals" target=3D"_blank">http://hackage.haskel=
l.org/trac/ghc/wiki/Commentary/Rts/Signals</a>:</span></div>
<div class=3D"gmail_quote">
<div><font face=3D"arial, helvetica, sans-serif"><br></font></div><div><fon=
t face=3D"arial, helvetica, sans-serif">&quot;<span style=3D"font-size:13px=
;background-color:rgb(255, 255, 255)">When the interrupt signal is received=
, the default behaviour of the runtime is to attempt to shut down the Haske=
ll program gracefully. It does this by calling=A0<tt>interruptStgRts()</tt>=
=A0in=A0<a href=3D"http://hackage.haskell.org/trac/ghc/browser/rts/Schedule=
.c" style=3D"text-decoration:none;border-bottom-width:1px;border-bottom-sty=
le:dotted;border-bottom-color:rgb(187, 187, 187)" target=3D"_blank">rts/Sch=
edule.c</a>=A0(see=A0<a href=3D"http://hackage.haskell.org/trac/ghc/wiki/Co=
mmentary/Rts/Scheduler#ShuttingDown" style=3D"text-decoration:none;border-b=
ottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(187, 187=
, 187)" target=3D"_blank">Commentary/Rts/Scheduler#ShuttingDown</a>). If a =
second interrupt signal is received, then we terminate the process immediat=
ely; this is just in case the normal shutdown procedure failed or hung for =
some reason, the user is always able to stop the process with two control-C=
 keystrokes&quot;</span></font></div>
</div></blockquote><div><br></div><div>On further thought, there is somethi=
ng sensible here: the RTS might crash while trying to exit. =A0I propose, f=
or POSIX environments, the following change to SIGINT handling:</div><div>
<br></div><div>* SIGINT is transformed into UserInterrupt during normal pro=
gram execution</div><div>* Once the RTS is committed to exiting, it resets =
the signal handler for SIGINT so that any additional control-c causes an im=
mediate exit</div>
<div><br></div><div>Makes sense?</div><div><br></div><div>Brian</div></div>=
</div>

--bcaec520eacb07ce1604b075a34d--



More information about the Haskell-Cafe mailing list