Date: Sun, 10 Nov 2019 02:27:52 +0000 From: bugzilla-noreply@freebsd.org To: haskell@FreeBSD.org Subject: [Bug 241849] lang/ghc: Enable USE_PTHREAD_FOR_ITIMER Message-ID: <bug-241849-16154@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D241849 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@FreeBSD.org Reporter: kevinz5000@gmail.com Flags: maintainer-feedback?(haskell@FreeBSD.org) Assignee: haskell@FreeBSD.org Created attachment 209025 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D209025&action= =3Dedit Patch The GHC RTS has an interval timer that is apparently used both in the threa= ded (-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: =3D=3D test.hs =3D=3D main =3D do c <- getChar putChar c $ ghc test.hs $ truss ./test.hs ... some stuff SIGNAL 26 (SIGVTALRM) code=3DSI_TIMER value=3D0x0 timerid=3D3 overrun=3D0 sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) =3D 0 (0x0) sigreturn(0x7fffffff9880) =3D 0 (0x0) ioctl(0,TIOCGETA,0x7fffffffa270) =3D 0 (0x0) poll({ 0/POLLIN },1,0) =3D 0 (0x0) select(1,{ 0 },{ },0x0,0x0) ERR#4 'Interrupted system call' SIGNAL 26 (SIGVTALRM) code=3DSI_TIMER value=3D0x0 timerid=3D3 overrun=3D0 sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) =3D 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) =3D 0 (0x0) poll({ 0/POLLIN },1,0) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) ... more of this select(1,{ 0 },{ },0x0,0x0) =3D 1 (0x1) ... more stuff --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-241849-16154>