Patchwork [trans-mem] Beginning of refactoring

login
register
mail settings
Submitter Torvald Riegel
Date Aug. 3, 2011, 10:50 a.m.
Message ID <1312368617.3533.221.camel@triegel.csb>
Download mbox | patch
Permalink /patch/108110/
State New
Headers show

Comments

Torvald Riegel - Aug. 3, 2011, 10:50 a.m.
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.
Richard Henderson - Aug. 3, 2011, 3:47 p.m.
On 08/03/2011 03:50 AM, Torvald Riegel wrote:
>     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.

Ok.


r~

Patch

diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index 9f84404..d336d60 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -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
diff --git a/libitm/query.cc b/libitm/query.cc
index 4905fc6..9a95211 100644
--- a/libitm/query.cc
+++ b/libitm/query.cc
@@ -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;
 }