Commits

Ozgun Ataman committed 8eabf0e

Reuse live resources instead of always creating new ones

Comments (0)

Files changed (1)

   resource <- liftIO . join . atomically $ do
     ents <- readTVar entries
     case ents of
-      (Entry{..}:es) -> writeTVar entries es >> return create
+      (Entry{..}:es) -> writeTVar entries es >> return (return entry)
       [] -> do
         used <- readTVar inUse
         when (used == maxResources) retry