on master help sign in
Vty: avoid race in "shutdown"
commit8207c1497f47378443f645d0e21697959b2858c4 authorJonathan Daugherty <cygnus@foobox.com> dateMon 15 Oct 2018, 11:06 (8 years ago) parent3ca08b3
1 file changed+1−2
src/Graphics/Vty.hs+1−2
src/Graphics/Vty.hs+1−2
@@ -119,9 +119,8 @@ intMkVty input out = do
119119
120120 shutdownVar <- atomically $ newTVar False
121121 let shutdownIo = do
122− alreadyShutdown <- atomically $ readTVar shutdownVar
122+ alreadyShutdown <- atomically $ swapTVar shutdownVar True
123123 when (not alreadyShutdown) $ do
124− atomically $ writeTVar shutdownVar True
125124 shutdownInput input
126125 releaseDisplay out
127126 releaseTerminal out