Comments
Patch
@@ -298,6 +298,7 @@ GTM::gtm_transaction::rollback (gtm_transaction_cp *cp)
if (parent_txns.size() > 0)
{
jb = parent_txns[0].jb;
+ id = parent_txns[0].id;
prop = parent_txns[0].prop;
}
// Reset the transaction. Do not reset this->state, which is handled by
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -59,7 +59,7 @@ _ITM_transactionId_t ITM_REGPARM
_ITM_getTransactionId (void)
{
struct gtm_transaction *tx = gtm_tx();
- return tx ? tx->id : _ITM_noTransactionId;
+ return (tx && (tx->nesting > 0)) ? tx->id : _ITM_noTransactionId;
}
This small patch fixes the rollback of the transaction ID as well as queries for it. OK for branch? commit bd83b4594c1f6eee09e0fa7b369557f986291f9b Author: Torvald Riegel <triegel@redhat.com> Date: Fri Jul 29 15:19:04 2011 +0200 Fix rollback and queries of transaction ID. * beginend.cc (GTM::gtm_transaction::rollback): Roll back tx id as well. * query.cc (_ITM_getTransactionId): There is no active transaction if the current nesting level is zero.