[GHC] #1185: can't do I/O in the child of forkProcess with
-threaded
GHC
trac at galois.com
Fri Mar 14 13:53:38 EDT 2008
#1185: can't do I/O in the child of forkProcess with -threaded
----------------------------+-----------------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: new
Priority: low | Milestone: _|_
Component: Runtime System | Version: 6.6
Severity: normal | Resolution:
Keywords: | Difficulty: Easy (1 hr)
Testcase: | Architecture: Unknown
Os: Unknown |
----------------------------+-----------------------------------------------
Comment (by igloo):
Replying to [comment:3 simonmar]:
> I'd advise against this. forking is a total pain in a multi-threaded
program, and I really don't want to commit to making it work for anything
other than simple fork/exec type usage (and possibly not even that - doing
the fork/exec in C is better).
>
> Do you really need both -threaded and `forkProcess`? Can you fork in C
''before'' starting up the Haskell runtime?
I really think we ought to be able to say something like
{{{
main = do args <- getArgs
configFile <- readConfigFile
let config = args .+. configFile
if runAsDaemon config
then daemonise realMain
else realMain
}}}
(where `daemonise` does the standard double-forking thing) without having
to resort to writing C code. Using `forkIO`, `forkOS` etc before
`daemonise` wouldn't necessarily have to be supported.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1185#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list