Make access to NameCache atomic. Sometimes needs a lock.
[ghc-hetmet.git] / compiler / main / HscTypes.lhs
index f23ff58..962c7a3 100644 (file)
@@ -117,8 +117,6 @@ import RdrName
 import Name
 import NameEnv
 import NameSet 
-import OccName         ( OccName, OccEnv, lookupOccEnv, mkOccEnv, emptyOccEnv, 
-                         extendOccEnv )
 import Module
 import InstEnv         ( InstEnv, Instance )
 import FamInstEnv      ( FamInstEnv, FamInst )
@@ -139,7 +137,7 @@ import Packages hiding ( Version(..) )
 import DynFlags                ( DynFlags(..), isOneShot, HscTarget (..), dopt,
                           DynFlag(..) )
 import DriverPhases    ( HscSource(..), isHsBoot, hscSourceString, Phase )
-import BasicTypes      ( IPName, Fixity, defaultFixity, WarningTxt(..) )
+import BasicTypes      ( IPName, defaultFixity, WarningTxt(..) )
 import OptimizationFuel        ( OptFuelState )
 import IfaceSyn
 import FiniteMap       ( FiniteMap )
@@ -166,6 +164,7 @@ import Data.Array       ( Array, array )
 import Data.List
 import Control.Monad    ( mplus, guard, liftM, when )
 import Exception
+import Control.Concurrent.MVar ( MVar )
 \end{code}
 
 
@@ -546,6 +545,9 @@ data HscEnv
                -- reflect sucking in interface files.  They cache the state of
                -- external interface files, in effect.
 
+        hsc_NC_lock :: !(MVar ()),
+                -- ^ A lock used for updating the name cache.
+
        hsc_FC   :: {-# UNPACK #-} !(IORef FinderCache),
                -- ^ The cached result of performing finding in the file system
        hsc_MLC  :: {-# UNPACK #-} !(IORef ModLocationCache),