-
Notifications
You must be signed in to change notification settings - Fork 21
WIP io-sim: flushTQueue does not maintain order #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is currently broken.
590512c
to
a261bd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor comment.
@@ -1,6 +1,6 @@ | |||
cabal-version: 3.0 | |||
name: io-sim | |||
version: 1.3.1.0 | |||
version: 1.3.1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you revert this, I figure out version changes when releasing to hackage.
@@ -95,7 +95,10 @@ tryPeekTQueueDefault (TQueue queue) = do | |||
[] -> Nothing | |||
|
|||
flushTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m [a] | |||
flushTQueueDefault (TQueue queue) = uncurry (++) <$> readTVar queue | |||
flushTQueueDefault (TQueue queue) = do | |||
xs <- uncurry (++) <$> readTVar queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to reverse the tail, e.g.
xs <- uncurry (++) <$> readTVar queue | |
xs <- (\front tail -> front ++ reverse tail) <$> readTVar queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know.. I was not trying to fix it yet, but get the other PR merged first.
Moved into #135 |
Quick reproduction to confirm another bug in
flushTQueue
discovered while working on #133.This currently fails: