Skip to content
Browse files

Reuse live resources instead of always creating new ones

  • Loading branch information...
1 parent 5a098d7 commit fced184eb3e965c2a4060c66f1e8de340bbca9fe @ozataman ozataman committed Aug 21, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 Data/Pool.hs
View
2 Data/Pool.hs
@@ -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

0 comments on commit fced184

Please sign in to comment.
Something went wrong with that request. Please try again.