Safe Haskell | Safe-Infered |
---|
Perform an IO action, and place its result in a TMVar
. See
also Control.Concurrent.MVarIO for an MVar
version.
Documentation
runOrTakeTMVar :: IO a -> TMVar b -> IO (Either a b)Source
This version of run
takes an additional TMVar
, and returns
its content or the result of the IO action, depending on which is
available first. Note that the action is not interrupted if the
TMVar
is the winner, so you may want to make sure it doesn't
stick around forever.
The function was made to support
selectOrTakeTMVar
, the reason this
library exists, and may not be useful outside of that context.