on master help sign in
Add isShutdown field to Vty.
commit57342ae29a09f019a1d39f06b763de269512074a authorIan Grant Jeffries <ian@housejeffries.com> dateMon 15 Oct 2018, 16:25 (8 years ago) parent8207c14
1 file changed+5−1
src/Graphics/Vty.hs+5−1
src/Graphics/Vty.hs+5−1
@@ -94,8 +94,9 @@ data Vty = Vty
9494 -- | Clean up after vty. A call to this function is necessary to
9595 -- cleanly restore the terminal state before application exit. The
9696 -- above methods will throw an exception if executed after this is
97− -- executed.
97+ -- executed. Idempotent.
9898 , shutdown :: IO ()
99+ , isShutdown :: IO Bool
99100 }
100101
101102-- | Create a Vty handle. At most one handle should be created at a time
@@ -125,6 +126,8 @@ intMkVty input out = do
125126 releaseDisplay out
126127 releaseTerminal out
127128
129+ let shutdownStatus = atomically $ readTVar shutdownVar
130+
128131 lastPicRef <- newIORef Nothing
129132 lastUpdateRef <- newIORef Nothing
130133
@@ -175,4 +178,5 @@ intMkVty input out = do
175178 , outputIface = out
176179 , refresh = innerRefresh
177180 , shutdown = shutdownIo
181+ , isShutdown = shutdownStatus
178182 }