File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
src/Control/Monad/Class/MonadSTM Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Revsion history of io-classes
2
2
3
+ ### next version
4
+
5
+ * Improved performance of ` tryReadTBQueueDefault ` .
6
+
3
7
### 1.8.0.1
4
8
5
9
* Added support for ` ghc-9.2 ` .
Original file line number Diff line number Diff line change @@ -919,12 +919,15 @@ tryReadTBQueueDefault (TBQueue rsize read _wsize write _size) = do
919
919
return (Just x)
920
920
[] -> do
921
921
ys <- readTVar write
922
- case reverse ys of
922
+ case ys of
923
923
[] -> return Nothing
924
+ _ -> do
925
+ -- NB. lazy: we want the transaction to be
926
+ -- short, otherwise it will conflict
927
+ let ~ (z,zs) = case reverse ys of
928
+ z': zs' -> (z',zs')
929
+ _ -> error " tryReadTBQueueDefault: impossible"
924
930
925
- -- NB. lazy: we want the transaction to be
926
- -- short, otherwise it will conflict
927
- (z: zs) -> do
928
931
writeTVar write []
929
932
writeTVar read zs
930
933
return (Just z)
You can’t perform that action at this time.
0 commit comments