[GHC] #1185: can't do I/O in the child of forkProcess with -threaded

GHC trac at galois.com
Fri Mar 14 11:24:45 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         |  
----------------------------+-----------------------------------------------
Changes (by tibbe):

 * cc: johan.tibell at gmail.com (added)
  * severity:  minor => normal

Comment:

 I need this to be able to do I/O in a forked process in order to implement
 a daemonized mode for my web server. I need to do something like:

 {{{
 server :: IO ()

 main =
   if daemonize
   then forkProcess $ server
   else server
 }}}

 I also need to do some I/O before forking (i.e. call `getArgs` to get
 command line flags to pass to `GetOpt`) to figure out if I should
 daemonize the process or not. Note that my web server is a library which
 `serve` method will be called by user code so I can't provide a wrapper
 script that forks the process since I don't have a binry to call.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1185#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list