Skip to content

Commit

Permalink
Merge pull request #940 from Vlix/waitforzero-tweak
Browse files Browse the repository at this point in the history
warp: changed check in 'waitForZero' to never loop indefinitely and arguably be more readable.
  • Loading branch information
kazu-yamamoto authored Sep 10, 2023
2 parents 8266fa5 + a46776c commit 5bffe8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Counter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ newCounter = Counter <$> newTVarIO 0
waitForZero :: Counter -> IO ()
waitForZero (Counter ref) = atomically $ do
x <- readTVar ref
unless (x == 0) retry
when (x > 0) retry

increase :: Counter -> IO ()
increase (Counter ref) = atomically $ modifyTVar' ref $ \x -> x + 1
Expand Down

0 comments on commit 5bffe8c

Please sign in to comment.