Skip to content

Commit

Permalink
Don't use readUnspentCredits util in other primitive.
Browse files Browse the repository at this point in the history
This clarifies that the only uses of readUnspentCredits are external to
the module. It's previous use in takeAllUnspentCredits was as part of a
CAS loop, which is really a primitive itself, and so it's misleading to
use the othe primitive here.
  • Loading branch information
dcoutts committed Jan 31, 2025
1 parent c30e331 commit 492094a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Database/LSMTree/Internal/MergingRun.hs
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,8 @@ takeAllUnspentCredits ::
PrimMonad m
=> UnspentCreditsVar (PrimState m)
-> m Credits
takeAllUnspentCredits
unspentCreditsVar@(UnspentCreditsVar !var) = do
prev <- readUnspentCredits unspentCreditsVar
takeAllUnspentCredits (UnspentCreditsVar !var) = do
prev <- readPrimVar var
casLoop prev
where
casLoop !prev = do
Expand Down

0 comments on commit 492094a

Please sign in to comment.