Created
July 17, 2019 17:52
-
-
Save lehins/3653b53a6ace028bf0158c53294145f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name <- atomically $ do | |
readTVar (currentUpdate ctxt) >>= \case | |
name:names <- readTVar (queuedUpdates ctxt) | |
writeTVar (queuedUpdates ctxt) names | |
return name | |
name <- atomically $ do | |
readTVar (currentUpdate ctxt) >>= \case | |
Just _ -> retry | |
Nothing -> readTVar (queuedUpdates ctxt) >>= \case | |
[] -> retry | |
(name:names) -> do | |
writeTVar (queuedUpdates ctxt) names | |
return name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment