Skip to content

Commit

Permalink
Reuse live resources instead of always creating new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
ozataman committed Aug 21, 2011
1 parent 5a098d7 commit fced184
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Data/Pool.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ withResource Pool{..} act = do
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
Expand Down

0 comments on commit fced184

Please sign in to comment.