summaryrefslogtreecommitdiff
path: root/compiler/HsVersions.h
diff options
context:
space:
mode:
authorThomas Schilling <nominolo@googlemail.com>2009-08-17 14:23:52 +0000
committerThomas Schilling <nominolo@googlemail.com>2009-08-17 14:23:52 +0000
commit4fa44a3ae9c36222ccb460ba3ed24e46bf7c70ae (patch)
tree3a141c84806004f03f59862ca77364380c2ba18d /compiler/HsVersions.h
parent9f68c34843602e815e71ef68f43adc01da993672 (diff)
downloadhaskell-4fa44a3ae9c36222ccb460ba3ed24e46bf7c70ae.tar.gz
Make the dynamic linker thread-safe.
The current implementation is rather pessimistic. The persistent linker state is now an MVar and all exported Linker functions are wrapped in modifyMVar calls. This is serves as a big lock around all linker functions. There might be a chance for more concurrency in a few places. E.g., extending the closure environment and loading packages might be independent in some cases. But for now it's better to be on the safe side.
Diffstat (limited to 'compiler/HsVersions.h')
-rw-r--r--compiler/HsVersions.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h
index 4e68bbe250..748b0319c8 100644
--- a/compiler/HsVersions.h
+++ b/compiler/HsVersions.h
@@ -30,11 +30,20 @@ you will screw up the layout where they are used in case expressions!
{-# NOINLINE name #-}; \
name :: IORef (ty); \
name = Util.global (value);
+
+#define GLOBAL_MVAR(name,value,ty) \
+{-# NOINLINE name #-}; \
+name :: MVar (ty); \
+name = Util.globalMVar (value);
#endif
#else /* __HADDOCK__ */
#define GLOBAL_VAR(name,value,ty) \
name :: IORef (ty); \
name = Util.global (value);
+
+#define GLOBAL_MVAR(name,value,ty) \
+name :: MVar (ty); \
+name = Util.globalMVar (value);
#endif
#define COMMA ,