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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# resource-pool-0.5.0.0 (2025-??-??)
* Drop support for GHC < 8.10.
* Use STM based lockless implementation as it results in much better throughput
in a multi-threaded environment when number of stripes is not equal to the
number of capabilities (in particular with a single stripe).
Expand Down
9 changes: 7 additions & 2 deletions resource-pool.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,22 @@ library
Data.Pool.Internal
Data.Pool.Introspection

build-depends: base >= 4.11 && < 5
build-depends: base >= 4.14 && < 5
, hashable >= 1.1.0.0
, primitive >= 0.7
, stm
, time

ghc-options: -Wall -Wcompat
ghc-options: -Wall
-Wcompat
-Wmissing-deriving-strategies
-Werror=prepositive-qualified-module

default-language: Haskell2010

default-extensions: DeriveGeneric
, DerivingStrategies
, ImportQualifiedPost
, LambdaCase
, RankNTypes
, ScopedTypeVariables
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Pool/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Control.Monad
import Data.Either
import Data.Hashable (hash)
import Data.IORef
import qualified Data.List as L
import Data.List qualified as L
import Data.Primitive.SmallArray
import GHC.Clock (getMonotonicTime)
import GHC.Conc (unsafeIOToSTM)
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Pool/Introspection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ data Resource a = Resource
, acquisitionTime :: !Double
, creationTime :: !(Maybe Double)
}
deriving (Eq, Show, Generic)
deriving stock (Eq, Show, Generic)

-- | Describes how a resource was acquired from the pool.
data Acquisition
= -- | A resource was taken from the pool immediately.
Immediate
| -- | The thread had to wait until a resource was released.
Delayed
deriving (Eq, Show, Generic)
deriving stock (Eq, Show, Generic)

-- | 'Data.Pool.withResource' with introspection capabilities.
withResource :: Pool a -> (Resource a -> IO r) -> IO r
Expand Down