Skip to content
Snippets Groups Projects
Commit c9604d73 authored by Jens Nolte's avatar Jens Nolte
Browse files

Add writeTMVar shim for old stm version


Co-authored-by: default avatarJan Beinke <git@janbeinke.com>
parent 72d71b72
No related branches found
No related tags found
No related merge requests found
......@@ -73,9 +73,7 @@ module Control.Concurrent.STM.Class (
takeTMVar,
putTMVar,
readTMVar,
#if MIN_VERSION_stm(2, 5, 1)
writeTMVar,
#endif
tryReadTMVar,
swapTMVar,
tryTakeTMVar,
......@@ -421,3 +419,12 @@ $(mconcat <$> (execWriterT do
'STM.newTBQueueIO
]
))
#if !MIN_VERSION_stm(2, 5, 1)
-- | Non-blocking write of a new value to a 'TMVar'
-- Puts if empty. Replaces if populated.
writeTMVar :: MonadSTM' r t m => STM.TMVar a -> a -> m ()
writeTMVar t new = unsafeLimitSTM $ tryTakeTMVar t >> putTMVar t new
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment