Date: Sun, 10 Nov 2019 02:27:52 +0000 From: bugzilla-noreply@freebsd.org To: haskell@FreeBSD.org Subject: maintainer-feedback requested: [Bug 241849] lang/ghc: Enable USE_PTHREAD_FOR_ITIMER Message-ID: <bug-241849-16154-JWhuhaBIu0@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-241849-16154@https.bugs.freebsd.org/bugzilla/> References: <bug-241849-16154@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-haskell mailing list <haskell@FreeBSD.org> for maintainer-feedback: Bug 241849: lang/ghc: Enable USE_PTHREAD_FOR_ITIMER https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D241849 --- Description --- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-241849-16154-JWhuhaBIu0>