#4449: GHC 7 can't do IO when demonized
------------------------------+---------------------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.1
Keywords: forkProcess | Testcase:
Blockedby: | Difficulty:
Os: MacOS X | Blocking:
Architecture: x86 | Failure: None/Unknown
------------------------------+---------------------------------------------
Comment(by guest):
I've done some tests with 7.0.1-rc2 on Linux (Debian/sid on 32bit arch):
{{{
hdaemonize without -threaded: works
direct-daemonize without -threaded: works
hdaemonize with -threaded: works
direct-daemonize with -threaded: hangs
}}}
Code with direct-daemonize looks like this:
{{{
import Control.Concurrent
import Network
import System.IO
import System.Daemonize
main :: IO ()
main = do
daemonize defaultDaemonOptions
s <- listenOn (Service "7000")
loop s
return ()
loop :: Socket -> IO ThreadId
loop s = do
(hdr,_,_) <- accept s
forkIO $ echo hdr
loop s
echo :: Handle -> IO ()
echo hdr = do
str <- hGetLine hdr
hPutStrLn hdr str
hClose hdr
return ()
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4449#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs