summaryrefslogtreecommitdiff
path: root/rts/STM.c
diff options
context:
space:
mode:
authorNicolas Frisby <nicolas.frisby@gmail.com>2013-08-22 15:00:41 -0500
committerNicolas Frisby <nicolas.frisby@gmail.com>2013-08-22 15:00:54 -0500
commit84f9927c1a04b8e35b97101771d8f6d625643d9b (patch)
tree050d7265a24fa1ff9aecc4081bb01bc444520587 /rts/STM.c
parent2eaf46fb1bb8c661c03f3e5e80622207ef2509d9 (diff)
parentc24be4b761df558d9edc9c0b1554bb558c261b14 (diff)
downloadhaskell-late-dmd.tar.gz
merged master into late-dmdlate-dmd
Diffstat (limited to 'rts/STM.c')
-rw-r--r--rts/STM.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/STM.c b/rts/STM.c
index eee0f46bbc..8f4bdfbecb 100644
--- a/rts/STM.c
+++ b/rts/STM.c
@@ -905,8 +905,12 @@ static StgBool check_read_only(StgTRecHeader *trec STG_UNUSED) {
s = e -> tvar;
if (entry_is_read_only(e)) {
TRACE("%p : check_read_only for TVar %p, saw %ld", trec, s, e -> num_updates);
- if (s -> num_updates != e -> num_updates) {
- // ||s -> current_value != e -> expected_value) {
+
+ // Note we need both checks and in this order as the TVar could be
+ // locked by another transaction that is committing but has not yet
+ // incremented `num_updates` (See #7815).
+ if (s -> current_value != e -> expected_value ||
+ s -> num_updates != e -> num_updates) {
TRACE("%p : mismatch", trec);
result = FALSE;
BREAK_FOR_EACH;