diff options
| author | hallgren <hallgren@chalmers.se> | 2014-09-08 15:43:20 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-09-08 15:43:20 +0000 |
| commit | 4eb6b55e980fda9c4d260820f5a6d38dde3d0991 (patch) | |
| tree | c771181c860137fb7a5bec7eaf3f899292b00aae /src/compiler/GFServer.hs | |
| parent | 4d28c7632e83aed413c22001ec0821971f58f14d (diff) | |
(1) Refactor concurrency, (2) write to .gfo.tmp then rename to .gfo
(1) introduces the module GF.Infra.Concurreny with lifted concurrency
operators (to reduce uses of liftIO) and some additional concurrency
utilities, e.g. a function for sequential logging that is used in
both GF.CompileInParallel and GFServer.
(2) avoids leaving broken .gfo files behind if compilation is aborted.
Diffstat (limited to 'src/compiler/GFServer.hs')
| -rw-r--r-- | src/compiler/GFServer.hs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs index a74167b9a..fbcca3d94 100644 --- a/src/compiler/GFServer.hs +++ b/src/compiler/GFServer.hs @@ -23,7 +23,7 @@ import System.FilePath(dropExtension,takeExtension,takeFileName,takeDirectory, import System.Posix.Files(getSymbolicLinkStatus,isSymbolicLink,removeLink, createSymbolicLink) #endif -import Control.Concurrent(forkIO,newMVar,modifyMVar,newChan,writeChan,getChanContents) +import GF.Infra.Concurrency(newMVar,modifyMVar,newLog) import Network.URI(URI(..)) import Network.Shed.Httpd(initServer,Request(..),Response(..),noCache) --import qualified Network.FastCGI as FCGI -- from hackage direct-fastcgi @@ -65,9 +65,7 @@ server port optroot execute1 state0 = where -- | HTTP server http_server execute1 state0 state cache root = - do log <- newChan -- to avoid intertwined log messages - forkIO $ mapM_ ePutStrLn =<< getChanContents log - let logLn = writeChan log + do logLn <- newLog ePutStrLn -- to avoid intertwined log messages logLn gf_version logLn $ "Document root = "++root logLn $ "Starting HTTP server, open http://localhost:" |
