STM slightly conservative on write-only transactions
The STM appears to be slightly too conservative on write-only transactions.
It will store a copy of the current (that is, old) value on a writeTVar, even if it was never read from. This can cause a spurious retry.
E.g. atomically $ writeTVar tv 0
really has no reason to ever retry. Neither, in fact, does atomically $ mapM (\tv -> writeTVar tv 0) [tv1,tv2,tv3,tv4]
.
My suggestion is to instead indicate "no prior value" for that TVar, and then make no consistency checks on TVars marked as no prior value...
Jules
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |