[Bug 241849] lang/ghc: Enable USE_PTHREAD_FOR_ITIMER
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Nov 10 02:27:54 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241849
Bug ID: 241849
Summary: lang/ghc: Enable USE_PTHREAD_FOR_ITIMER
Product: Ports & Packages
Version: Latest
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: Individual Port(s)
Assignee: haskell at FreeBSD.org
Reporter: kevinz5000 at gmail.com
Flags: maintainer-feedback?(haskell at FreeBSD.org)
Assignee: haskell at FreeBSD.org
Created attachment 209025
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=209025&action=edit
Patch
The GHC RTS has an interval timer that is apparently used both in the threaded
(-threaded) and non-threaded runtime.
On some operating systems, rts/posix/Itimer.c sets USE_PTHREAD_FOR_ITIMER,
which uses usleep() at regular intervals instead of SIGVALRM.
Per the comments about Darwin (macOS) above:
* 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.
The attached patch applies this for FreeBSD as well.
To see the difference, run 'truss' on a simple test program:
== test.hs ==
main = do
c <- getChar
putChar c
$ ghc test.hs
$ truss ./test.hs
... some stuff
SIGNAL 26 (SIGVTALRM) code=SI_TIMER value=0x0 timerid=3 overrun=0
sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) = 0 (0x0)
sigreturn(0x7fffffff9880) = 0 (0x0)
ioctl(0,TIOCGETA,0x7fffffffa270) = 0 (0x0)
poll({ 0/POLLIN },1,0) = 0 (0x0)
select(1,{ 0 },{ },0x0,0x0) ERR#4 'Interrupted system
call'
SIGNAL 26 (SIGVTALRM) code=SI_TIMER value=0x0 timerid=3 overrun=0
sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) = 0 (0x0)
sigreturn(0x7fffffffd6c0) ERR#4 'Interrupted system
call'
select(1,{ 0 },{ },0x0,0x0) ERR#4 'Interrupted system
call'
... more of this
After this change:
... some stuff
ioctl(0,TIOCGETA,0x7fffffffa270) = 0 (0x0)
poll({ 0/POLLIN },1,0) = 0 (0x0)
nanosleep({ 0.010000000 }) = 0 (0x0)
nanosleep({ 0.010000000 }) = 0 (0x0)
nanosleep({ 0.010000000 }) = 0 (0x0)
... more of this
select(1,{ 0 },{ },0x0,0x0) = 1 (0x1)
... more stuff
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-ports-bugs
mailing list