summaryrefslogtreecommitdiff
path: root/rts/posix
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-12-07 08:50:52 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-07 09:55:29 -0500
commitd70d452a38bed3321bfc3c14074a6b3e1f30a090 (patch)
treef8da39d2d764b47670fb68bc6db5bc81d373bee7 /rts/posix
parent9043a4002623679989a2fdc4e97d484a9d58d619 (diff)
downloadhaskell-d70d452a38bed3321bfc3c14074a6b3e1f30a090.tar.gz
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
Diffstat (limited to 'rts/posix')
-rw-r--r--rts/posix/Itimer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c
index ee93dd7719..59d34be5fb 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