aboutsummaryrefslogtreecommitdiff
path: root/libitm/method-ml.cc
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2016-01-13 12:40:34 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2016-01-13 12:40:34 +0000
commit629e47295b44d9adf01b66061dd891a25e567474 (patch)
tree0f4bfc83fa01d0a035d86c869e199905d89075cb /libitm/method-ml.cc
parent8bc47ae2a784685f79dca8d7d04135c939a49452 (diff)
downloadgcc-629e47295b44d9adf01b66061dd891a25e567474.zip
gcc-629e47295b44d9adf01b66061dd891a25e567474.tar.gz
gcc-629e47295b44d9adf01b66061dd891a25e567474.tar.bz2
libitm: Fix privatization safety interaction with serial mode.
From-SVN: r232322
Diffstat (limited to 'libitm/method-ml.cc')
-rw-r--r--libitm/method-ml.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/libitm/method-ml.cc b/libitm/method-ml.cc
index 1c2de701..723643a 100644
--- a/libitm/method-ml.cc
+++ b/libitm/method-ml.cc
@@ -604,6 +604,24 @@ public:
tx->readlog.clear();
}
+ virtual bool snapshot_most_recent()
+ {
+ // This is the same code as in extend() except that we do not restart
+ // on failure but simply return the result, and that we don't validate
+ // if our snapshot is already most recent.
+ gtm_thread* tx = gtm_thr();
+ gtm_word snapshot = o_ml_mg.time.load(memory_order_acquire);
+ if (snapshot == tx->shared_state.load(memory_order_relaxed))
+ return true;
+ if (!validate(tx))
+ return false;
+
+ // Update our public snapshot time. Necessary so that we do not prevent
+ // other transactions from ensuring privatization safety.
+ tx->shared_state.store(snapshot, memory_order_release);
+ return true;
+ }
+
virtual bool supports(unsigned number_of_threads)
{
// Each txn can commit and fail and rollback once before checking for