[commit: ghc] ghc-7.6: rts: Ignore signal before deleting timer. Fixes #7303. (162b87d)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/162b87dfc610efa54ce3276e9a1e90b9dcb141a7

>---------------------------------------------------------------

commit 162b87dfc610efa54ce3276e9a1e90b9dcb141a7
Author: Erik de Castro Lopo <[email protected]>
Date:   Sat Oct 6 17:23:01 2012 +1000

    rts: Ignore signal before deleting timer. Fixes #7303.
    
    Was getting an ocassional hang or segfault when building GHC in a
    Qemu user space emulation of ARM. Turned out that the ITIMER_SIGNAL
    was being delivered *after* the call to timer_delete(). Setting the
    signal to SIG_IGN before deleting the timer solves the problem.

>---------------------------------------------------------------

 rts/posix/Itimer.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c
index 8c9b1f8..80b3b56 100644
--- a/rts/posix/Itimer.c
+++ b/rts/posix/Itimer.c
@@ -204,6 +204,9 @@ void
 exitTicker (rtsBool wait STG_UNUSED)
 {
 #if defined(USE_TIMER_CREATE)
+    // Before deleting the timer set the signal to ignore to avoid the
+    // possibility of the signal being delivered after the timer is deleted.
+    signal(ITIMER_SIGNAL, SIG_IGN);
     timer_delete(timer);
     // ignore errors - we don't really care if it fails.
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.