summaryrefslogtreecommitdiff
path: root/src/server/FastCGIUtils.hs
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-10-17 14:12:53 +0000
committerbjorn <bjorn@bringert.net>2008-10-17 14:12:53 +0000
commit0205f341f5d817fcf3a43057db9d0ef2a23af98c (patch)
tree4366decc9c90f0d7e663499e787a122378b8e417 /src/server/FastCGIUtils.hs
parenteb0fefec28cf9c089c55f1ef5de9c772faa61786 (diff)
(fastcgi) replace DataRef with a more general Cache type, which can hold several PGF grammars.
Diffstat (limited to 'src/server/FastCGIUtils.hs')
-rw-r--r--src/server/FastCGIUtils.hs26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/server/FastCGIUtils.hs b/src/server/FastCGIUtils.hs
index 1b75403d5..e9824d099 100644
--- a/src/server/FastCGIUtils.hs
+++ b/src/server/FastCGIUtils.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
module FastCGIUtils (initFastCGI, loopFastCGI,
- DataRef, newDataRef, getData,
throwCGIError, handleCGIErrors) where
import Control.Concurrent
@@ -17,7 +16,6 @@ import System.IO.Unsafe
import System.Posix
import System.Time
-
import Network.FastCGI
initFastCGI :: IO ()
@@ -101,30 +99,6 @@ restartIfModified =
-- FIXME: setCurrentDirectory?
executeFile prog False args Nothing
--- Utilities for getting and caching read-only data from disk.
--- The data is reloaded when the file on disk has been modified.
-
-data DataRef a = DataRef {
- dataFile :: FilePath,
- dataLoad :: FilePath -> IO a,
- dataValue :: MVar (ClockTime, a)
- }
-
-newDataRef :: (FilePath -> IO a) -> FilePath -> IO (DataRef a)
-newDataRef load file =
- do t <- getModificationTime file
- x <- load file
- v <- newMVar (t,x)
- return $ DataRef { dataFile = file, dataLoad = load, dataValue = v }
-
-getData :: DataRef a -> IO a
-getData ref =
- do t' <- getModificationTime (dataFile ref)
- (t,x) <- takeMVar (dataValue ref)
- x' <- if t' == t then return x else (dataLoad ref) (dataFile ref)
- putMVar (dataValue ref) (t',x')
- return x'
-
-- Logging
logError :: String -> IO ()