[commit: ghc] master: rts: Use pthread itimer implementation on Darwin (d70d452)

git at git.haskell.org git at git.haskell.org
Wed Dec 7 15:50:25 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d70d452a38bed3321bfc3c14074a6b3e1f30a090/ghc

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

commit d70d452a38bed3321bfc3c14074a6b3e1f30a090
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Wed Dec 7 08:50:52 2016 -0500

    rts: Use pthread itimer implementation on Darwin
    
    We want to avoid using SIGALRM whenever possible since we will interrupt
    long-running system calls. See #10840.
    
    Test Plan: Validate on Darwin
    
    Reviewers: austin, erikd, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2796
    
    GHC Trac Issues: #10840


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

d70d452a38bed3321bfc3c14074a6b3e1f30a090
 rts/posix/Itimer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c
index ee93dd7..59d34be 100644
--- a/rts/posix/Itimer.c
+++ b/rts/posix/Itimer.c
@@ -30,6 +30,15 @@
 #endif
 
 /*
+ * We want to avoid using the SIGALRM signals whenever possible as these signals
+ * interrupt system calls (see #10840) and can be overridden by user code. On
+ * Darwin we can use a dedicated thread and usleep.
+ */
+#if defined(darwin_HOST_OS)
+#define USE_PTHREAD_FOR_ITIMER
+#endif
+
+/*
  * On Linux in the threaded RTS we can use timerfd_* (introduced in Linux
  * 2.6.25) and a thread instead of alarm signals. It avoids the risk of
  * interrupting syscalls (see #10840) and the risk of being accidentally



More information about the ghc-commits mailing list