Install toplevel handler inside fork.
authorAlexander Vershilov <alexander.vershilov@gmail.com>
Fri, 2 Dec 2016 19:32:48 +0000 (14:32 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 2 Dec 2016 20:29:15 +0000 (15:29 -0500)
commit895a131f6e56847d9ebca2e9bfe19a3189e49d72
tree0b54a54e22104ccf5b790a02448f6fb6875812a2
parentf46369b8a1bf90a3bdc30f2b566c3a7e03672518
Install toplevel handler inside fork.

When rts is forked it doesn't update toplevel handler, so UserInterrupt
exception is sent to Thread1 that doesn't exist in forked process.

We install toplevel handler when fork so signal will be delivered to the
new main thread.

Fixes #12903

Reviewers: simonmar, austin, erikd, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2770

GHC Trac Issues: #12903
includes/RtsAPI.h
rts/Prelude.h
rts/RtsAPI.c
rts/RtsSymbols.c
rts/Schedule.c
rts/package.conf.in
testsuite/tests/rts/T12903.hs [new file with mode: 0644]
testsuite/tests/rts/T12903.stdout [new file with mode: 0644]
testsuite/tests/rts/all.T