[commit: ghc] master: Check to see if TVar's are locked in check_read_only (fixes #7815) (87baa31)
Ian Lynagh
igloo at earth.li
Wed Apr 17 23:01:32 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
https://github.com/ghc/ghc/commit/87baa31cb117181ab4f4b26387653996d1792167
>---------------------------------------------------------------
commit 87baa31cb117181ab4f4b26387653996d1792167
Author: Ryan Yates <ryates at cs.rochester.edu>
Date: Mon Apr 8 19:18:51 2013 -0400
Check to see if TVar's are locked in check_read_only (fixes #7815)
>---------------------------------------------------------------
rts/STM.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/rts/STM.c b/rts/STM.c
index eee0f46..8f4bdfb 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;
More information about the ghc-commits
mailing list