Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# resource-pool-0.5.0.1 (2026-??-??)
* Fix a bug where a thread waiting for a resource would get stuck in the queue
indefinitely if resource creation failed in another thread.

# resource-pool-0.5.0.0 (2025-06-13)
* Drop support for GHC < 8.10.
* Use STM based lockless implementation as it results in much better throughput
Expand Down
2 changes: 1 addition & 1 deletion resource-pool.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.0
build-type: Simple
name: resource-pool
version: 0.5.0.0
version: 0.5.0.1
license: BSD-3-Clause
license-file: LICENSE
category: Data, Database, Network
Expand Down
6 changes: 5 additions & 1 deletion src/Data/Pool/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ waitForResource mstripe q = atomically (takeTMVar q) `onException` cleanup
-- original size of the stripe.
restoreSize :: TVar (Stripe a) -> IO ()
restoreSize mstripe = atomically $ do
modifyTVar' mstripe $ \stripe -> stripe {available = available stripe + 1}
stripe <- readTVar mstripe
-- Signal needs to be called so that if there are threads waiting for a
-- resource, one of them wakes up and attempts the creation itself.
newStripe <- signal stripe Nothing
writeTVar mstripe $! newStripe

-- | Free resource entries in the stripes that fulfil a given condition.
cleanStripe
Expand Down
Loading