@@ -9,7 +9,8 @@ where
10import Control.Monad (when, forM_)
10import Control.Monad (when, forM_)
11import qualified Control.Exception as E
11import qualified Control.Exception as E
12+import GHC.Conc.Sync (withMVar)
12−import Control.Concurrent.MVar (MVar, newMVar, takeMVar, putMVar)
13+import Control.Concurrent.MVar (MVar, newMVar)
13import Data.Word (Word8, Word32)
14import Data.Word (Word8, Word32)
14#if !(MIN_VERSION_base(4,11,0))
15#if !(MIN_VERSION_base(4,11,0))
15import Data.Semigroup ((<>))
16import Data.Semigroup ((<>))
@@ -31,14 +32,7 @@ isCustomTableReady :: IO Bool
31isCustomTableReady = withInstallLock $ (== 1) <$> c_isCustomTableReady
32isCustomTableReady = withInstallLock $ (== 1) <$> c_isCustomTableReady
33withInstallLock :: IO a -> IO a
34withInstallLock :: IO a -> IO a
34−withInstallLock act =
35+withInstallLock act = withMVar installLock $ const act
35− E.bracket takeInstallLock (const releaseInstallLock) $ const act
37−takeInstallLock :: IO ()
38−takeInstallLock = takeMVar installLock
40−releaseInstallLock :: IO ()
41−releaseInstallLock = putMVar installLock ()
43-- This is the size of the allocated custom character width table, in
37-- This is the size of the allocated custom character width table, in
44-- character slots. It's important that this be large enough to hold all
38-- character slots. It's important that this be large enough to hold all