File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22* Use STM based lockless implementation as it results in much better throughput
33 in a multi-threaded environment when number of stripes is not equal to the
44 number of capabilities (in particular with a single stripe).
5+ * Stop running resource freeing functions within ` uninterruptibleMask ` .
56
67# resource-pool-0.4.0.0 (2023-01-16)
78* Require ` poolMaxResources ` to be not smaller than the number of stripes.
Original file line number Diff line number Diff line change @@ -279,9 +279,10 @@ cleanStripe isStale free mstripe = mask_ $ do
279279 pure $ map entry stale
280280 -- We need to ignore exceptions in the 'free' function, otherwise if an
281281 -- exception is thrown half-way, we leak the rest of the resources. Also,
282- -- asynchronous exceptions need to be hard masked here since freeing a
283- -- resource might in theory block.
284- uninterruptibleMask_ . forM_ stale $ try @ SomeException . free
282+ -- asynchronous exceptions need to be hard masked here we need to run 'free'
283+ -- for all resources.
284+ uninterruptibleMask $ \ release -> do
285+ forM_ stale $ try @ SomeException . release . free
285286
286287signal :: forall a . Stripe a -> Maybe a -> STM (Stripe a )
287288signal stripe ma =
You can’t perform that action at this time.
0 commit comments