
#13497: GHC does not use select()/poll() correctly on non-Linux platforms -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8684, #12912 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Hmm looks like I also discovered that `fdReady()` doesn't work at all on Windows for the `case FILE_TYPE_PIPE`. This example file {{{ import System.IO main = hWaitForInput stdin (5 * 1000) }}} when compiled with `ghc --make -O -fforce-recomp ../example-windows- pipe.hs && time ../example-windows-pipe.hs` terminates immediately instead of waiting for 5 seconds. The reason seems to be that the `PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL )`, which is called only once in `fdReady()`, doesn't have any blocking feature. From the docs https://msdn.microsoft.com/en- us/library/windows/desktop/aa365779(v=vs.85).aspx
The function always returns immediately in a single-threaded application, even if there is no data in the pipe
(Not sure why it says "in a single-threaded application"; the same problem happens with `-threaded` and `+RTS -N2`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13497#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler