$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56944 - in sandbox/stm: boost boost/stm boost/stm/detail boost/stm/tx libs/stm/example libs/stm/src
From: vicente.botet_at_[hidden]
Date: 2009-10-16 22:46:46
Author: viboes
Date: 2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
New Revision: 56944
URL: http://svn.boost.org/trac/boost/changeset/56944
Log:
TBoost.STM: 
* Added current transaction function + transactions stack
* Added numeric transparent transaction object
* Added pointer transparent transaction object
Added:
   sandbox/stm/boost/stm/detail/transactions_stack.hpp   (contents, props changed)
   sandbox/stm/boost/stm/tx/
   sandbox/stm/boost/stm/tx/numeric.hpp   (contents, props changed)
   sandbox/stm/boost/stm/tx/pointer.hpp   (contents, props changed)
   sandbox/stm/libs/stm/example/numeric.cpp   (contents, props changed)
Text files modified: 
   sandbox/stm/boost/stm.hpp                         |    14 ++--                                    
   sandbox/stm/boost/stm/detail/config.hpp           |    22 ++++----                                
   sandbox/stm/boost/stm/detail/transaction_impl.hpp |    60 ++++++++++++---------                   
   sandbox/stm/boost/stm/transaction.hpp             |   109 +++++++++++++++++++++++++++++++++------ 
   sandbox/stm/libs/stm/src/transaction.cpp          |    89 ++++++++++++++++++-------------         
   5 files changed, 195 insertions(+), 99 deletions(-)
Modified: sandbox/stm/boost/stm.hpp
==============================================================================
--- sandbox/stm/boost/stm.hpp	(original)
+++ sandbox/stm/boost/stm.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Justin E. Gottchlich 2009. 
-// (C) Copyright Vicente J. Botet Escriba 2009. 
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
 // Distributed under the Boost
-// Software License, Version 1.0. 
-// (See accompanying file LICENSE_1_0.txt or 
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
-/* The DRACO Research Group (rogue.colorado.edu/draco) */ 
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
 /*****************************************************************************\
  *
  * Copyright Notices/Identification of Licensor(s) of
@@ -37,6 +37,8 @@
 
 #include <boost/stm/transaction.hpp>
 #include <boost/stm/contention_manager.hpp>
+#include <boost/stm/tx/numeric.hpp>
+#include <boost/stm/tx/pointer.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 #endif // TRANSACTION_H
Modified: sandbox/stm/boost/stm/detail/config.hpp
==============================================================================
--- sandbox/stm/boost/stm/detail/config.hpp	(original)
+++ sandbox/stm/boost/stm/detail/config.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -1,26 +1,26 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Justin E. Gottchlich 2009. 
-// (C) Copyright Vicente J. Botet Escriba 2009. 
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
 // Distributed under the Boost
-// Software License, Version 1.0. 
-// (See accompanying file LICENSE_1_0.txt or 
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Justin E. Gottchlich 2009. 
-// (C) Copyright Vicente J. Botet Escriba 2009. 
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
 // Distributed under the Boost
-// Software License, Version 1.0. 
-// (See accompanying file LICENSE_1_0.txt or 
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
@@ -32,7 +32,7 @@
 //#define PERFORMING_VALIDATION 1
 #define PERFORMING_LATM 1
 #define PERFORMING_COMPOSITION 1
-#define USE_STM_MEMORY_MANAGER 1
+//#define USE_STM_MEMORY_MANAGER 1
 #define BUILD_MOVE_SEMANTICS 0
 #define USING_TRANSACTION_SPECIFIC_LATM 1
 #define USE_BLOOM_FILTER 1
Modified: sandbox/stm/boost/stm/detail/transaction_impl.hpp
==============================================================================
--- sandbox/stm/boost/stm/detail/transaction_impl.hpp	(original)
+++ sandbox/stm/boost/stm/detail/transaction_impl.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -7,7 +7,7 @@
 // (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
@@ -406,7 +406,7 @@
    {
       unlock(i->second);
    }
-   hasMutex_ = 0;  
+   hasMutex_ = 0;
 }
 
 //--------------------------------------------------------------------------
@@ -429,10 +429,11 @@
    //-----------------------------------------------------------------------
 
    threadId_(THREAD_ID),
+   //transactionMutexLocker_(),
    auto_general_lock_(general_lock()),
 
 #if USE_SINGLE_THREAD_CONTEXT_MAP
-////////////////////////////////////////   
+////////////////////////////////////////
    context_(*tss_context_map_.find(threadId_)->second),
 
 #ifdef BOOST_STM_TX_CONTAINS_REFERENCES_TO_TSS_FIELDS
@@ -447,7 +448,7 @@
 #else
    forcedToAbortRef_(false),
 #endif
-#endif   
+#endif
    mutexRef_(threadMutexes_.find(threadId_)->second),
 
 #if PERFORMING_LATM
@@ -461,10 +462,12 @@
    obtainedLocksRef_(*threadObtainedLocks_.find(threadId_)->second),
    currentlyLockedLocksRef_(*threadCurrentlyLockedLocks_.find(threadId_)->second),
 #endif
-   
-////////////////////////////////////////   
+
+   transactionsRef_(transactions(threadId_)),
+
+////////////////////////////////////////
 #else
-////////////////////////////////////////   
+////////////////////////////////////////
 #ifndef DISABLE_READ_SETS
    readListRef_(*threadReadLists_.find(threadId_)->second),
 #endif
@@ -497,15 +500,17 @@
    currentlyLockedLocksRef_(*threadCurrentlyLockedLocks_.find(threadId_)->second),
 #endif
 
-////////////////////////////////////////   
+////////////////////////////////////////
+   transactionsRef_(transactions(threadId_)),
 #endif
 
    hasMutex_(0), priority_(0),
    state_(e_no_state),
    reads_(0),
-   startTime_(time(NULL))
+   startTime_(time(0))
 {
    auto_general_lock_.release_lock();
+    //transactionMutexLocker_.unlock();
 
    if (direct_updating()) doIntervalDeletions();
 #if PERFORMING_LATM
@@ -513,6 +518,7 @@
 #endif
 
    put_tx_inflight();
+   transactions().push(this);
 }
 
 //--------------------------------------------------------------------------
@@ -588,7 +594,7 @@
 #ifdef LOGGING_BLOCKS
       if (++iterations > 100)
       {
-         var_auto_lock<PLOCK> autolock(latm_lock(), general_lock(), NULL);
+         var_auto_lock<PLOCK> autolock(latm_lock(), general_lock(), 0);
          //unblock_threads_if_locks_are_empty();
          logFile_ << outputBlockedThreadsAndLockedLocks().c_str();
          SLEEP(10000);
@@ -1446,7 +1452,7 @@
          static int stalling_ = 0;
 
          bool wait = stalling_ * stalls_ < global_clock();
-         transaction *stallingOn = NULL;
+         transaction *stallingOn = 0;
          //int iter = 1;
 
 #if USE_BLOOM_FILTER
@@ -1774,9 +1780,9 @@
    for (WriteContainer::iterator i = writeList().begin(); writeList().end() != i; ++i)
    {
       //-----------------------------------------------------------------------
-      // i->second == NULL will happen when a transaction has added a piece of
+      // i->second == 0 will happen when a transaction has added a piece of
       // memory to its writeList_ that it is deleting (not writing to).
-      // Thus, when seeing NULL as the second value, it signifies that this
+      // Thus, when seeing 0 as the second value, it signifies that this
       // memory is being destroyed, not updated. Do not perform copy_state()
       // on it.
       //
@@ -1784,7 +1790,7 @@
       // transaction_thread (which is performed in    void directAbortTransactionDeletedMemory() throw();
 
       //-----------------------------------------------------------------------
-      if (NULL == i->second) continue;
+      if (0 == i->second) continue;
 
       if (using_move_semantics()) i->first->move_state(i->second);
       else i->first->copy_state(i->second);
@@ -1822,7 +1828,7 @@
 //----------------------------------------------------------------------------
 inline size_t boost::stm::transaction::earliest_start_time_of_inflight_txes()
 {
-   var_auto_lock<PLOCK> a(inflight_lock(), NULL);
+   var_auto_lock<PLOCK> a(inflight_lock(), 0);
 
    size_t secs = 0xffffffff;
 
@@ -1847,7 +1853,7 @@
 
    size_t earliestInFlightTx = earliest_start_time_of_inflight_txes();
 
-   var_auto_lock<PLOCK> a(&deletionBufferMutex_, NULL);
+   var_auto_lock<PLOCK> a(&deletionBufferMutex_, 0);
 
    for (DeletionBuffer::iterator i = deletionBuffer_.begin(); i != deletionBuffer_.end();)
    {
@@ -1874,9 +1880,9 @@
 
    if (!deletedMemoryList().empty())
    {
-      var_auto_lock<PLOCK> a(&deletionBufferMutex_, NULL);
+      var_auto_lock<PLOCK> a(&deletionBufferMutex_, 0);
       deletionBuffer_.insert( std::pair<size_t, MemoryContainerList>
-         (time(NULL), deletedMemoryList()) );
+         (time(0), deletedMemoryList()) );
       deletedMemoryList().clear();
    }
 }
@@ -1924,9 +1930,9 @@
    for (WriteContainer::iterator i = writeList().begin(); writeList().end() != i; ++i)
    {
       //-----------------------------------------------------------------------
-      // i->second == NULL will happen when a transaction has added a piece of
+      // i->second == 0 will happen when a transaction has added a piece of
       // memory to its writeList_ that it is deleting (not writing to).
-      // Thus, when seeing NULL as the second value, it signifies that this
+      // Thus, when seeing 0 as the second value, it signifies that this
       // memory is being destroyed, not updated. Do not perform copyState()
       // on it.
       //-----------------------------------------------------------------------
@@ -1950,13 +1956,13 @@
    for (WriteContainer::iterator i = writeList().begin(); writeList().end() != i; ++i)
    {
       //-----------------------------------------------------------------------
-      // i->second == NULL will happen when a transaction has added a piece of
+      // i->second == 0 will happen when a transaction has added a piece of
       // memory to its writeList_ that it is deleting (not writing to).
-      // Thus, when seeing NULL as the second value, it signifies that this
+      // Thus, when seeing 0 as the second value, it signifies that this
       // memory is being destroyed, not updated. Do not perform copyState()
       // on it.
       //-----------------------------------------------------------------------
-      if (NULL == i->second)
+      if (0 == i->second)
       {
          continue;
       }
@@ -1999,7 +2005,7 @@
    // copy the newObject into the oldObject, updating the real data
    for (WriteContainer::iterator i = writeList().begin(); writeList().end() != i; ++i)
    {
-      if (NULL == i->second) continue;
+      if (0 == i->second) continue;
       if (i->first->version_ != i->second->version_)
       {
          bookkeeping_.inc_write_aborts();
@@ -2045,7 +2051,7 @@
    if (writes() > 3) allow_stall = false;
 
    //--------------------------------------------------------------------------
-   // FOR THE TIME BEING, DO NOT ALLOW STALLS AT ALL! Stalls somehow cause 
+   // FOR THE TIME BEING, DO NOT ALLOW STALLS AT ALL! Stalls somehow cause
    // Sebastian's account code to break ... we need to investigate why and fix it.
    //
    // Until such time, stalling txes for increased concurrency MUST be disabled.
@@ -2054,7 +2060,7 @@
    allow_stall = false;
 
    //--------------------------------------------------------------------------
-   // FOR THE TIME BEING, DO NOT ALLOW STALLS AT ALL! Stalls somehow cause 
+   // FOR THE TIME BEING, DO NOT ALLOW STALLS AT ALL! Stalls somehow cause
    // Sebastian's account code to break ... we need to investigate why and fix it.
    //
    // Until such time, stalling txes for increased concurrency MUST be disabled.
@@ -2166,7 +2172,7 @@
       if (cm_->permission_to_abort(*this, aborted))
       {
          // ok, forced to aborts are allowed, do them
-         for (std::list<transaction*>::iterator k = aborted.begin(); 
+         for (std::list<transaction*>::iterator k = aborted.begin();
               k != aborted.end(); ++k)
          {
             (*k)->force_to_abort();
Added: sandbox/stm/boost/stm/detail/transactions_stack.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/boost/stm/detail/transactions_stack.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,49 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TRANSACTIONS_STACK__HPP
+#define BOOST_STM_TRANSACTIONS_STACK__HPP
+
+#include <stack>
+namespace boost { namespace stm {
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class transaction;
+
+namespace detail {
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+struct transactions_stack {
+    typedef std::stack<transaction*> cont_type;
+    cont_type stack_;
+    transactions_stack() {
+        // the stack at least one element (0) so we can always call to top, i.e. current transaction is 0
+        stack_.push(0);
+    }
+    void push(transaction* ptr) {stack_.push(ptr);}
+    void pop() {stack_.pop();}
+    std::size_t size() {return stack_.size();}
+    transaction* top() {return stack_.top();}
+};
+
+}
+
+typedef detail::transactions_stack TransactionsStack;
+
+}}
+
+//-----------------------------------------------------------------------------
+#endif // BOOST_STM_TRANSACTION_STACK__HPP
+
+
Modified: sandbox/stm/boost/stm/transaction.hpp
==============================================================================
--- sandbox/stm/boost/stm/transaction.hpp	(original)
+++ sandbox/stm/boost/stm/transaction.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -7,7 +7,7 @@
 // (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
@@ -53,6 +53,8 @@
 #include <vector>
 #include <pthread.h>
 
+#include <boost/stm/detail/transactions_stack.hpp>
+
 #if BUILD_MOVE_SEMANTICS
 #include <type_traits>
 #endif
@@ -81,6 +83,14 @@
 
    typedef std::pair<base_transaction_object*, base_transaction_object*> tx_pair;
 
+   template <typename MUTEX, MUTEX& mtx>
+   struct locker {
+       inline locker();
+       inline ~locker();
+       inline void unlock();
+   };
+
+
 ///////////////////////////////////////////////////////////////////////////////
 // transaction Class
 ///////////////////////////////////////////////////////////////////////////////
@@ -110,6 +120,7 @@
    typedef std::list<base_transaction_object*> MemoryContainerList;
 #endif
 
+   typedef std::map<size_t, TransactionsStack*> ThreadTransactionsStack;
    typedef std::map<size_t, WriteContainer*> ThreadWriteContainer;
    typedef std::map<size_t, TxType*> ThreadTxTypeContainer;
 
@@ -463,7 +474,7 @@
 
    template <typename T> T const * read_ptr(T const * in)
    {
-      if (NULL == in) return NULL;
+      if (0 == in) return 0;
       return &read(*in);
    }
    template <typename T> T const & r(T const & in) { return read(in); }
@@ -478,13 +489,13 @@
       if (direct_updating())
       {
          if (in.transaction_thread() == threadId_) return (T*)(&in);
-         else return NULL;
+         else return 0;
       }
       else
       {
          WriteContainer::iterator i = writeList().find
             ((base_transaction_object*)(&in));
-         if (i == writeList().end()) return NULL;
+         if (i == writeList().end()) return 0;
          else return static_cast<T*>(i->second);
       }
    }
@@ -526,7 +537,7 @@
    //--------------------------------------------------------------------------
    template <typename T> T* write_ptr(T* in)
    {
-      if (NULL == in) return NULL;
+      if (0 == in) return 0;
       return &write(*in);
    }
    template <typename T> T& w(T& in) { return write(in); }
@@ -938,7 +949,7 @@
          unlock(&transactionMutex_);
          // is this really necessary? in the deferred case it is, but in direct it
          // doesn't actually save any time for anything
-         //writeList()[(base_transaction_object*)&in] = NULL;
+         //writeList()[(base_transaction_object*)&in] = 0;
 
          deletedMemoryList().push_back((base_transaction_object*)&in);
       }
@@ -1071,7 +1082,7 @@
          lock_tx();
          bloom().insert((size_t)&in);
          unlock_tx();
-         writeList().insert(tx_pair((base_transaction_object*)&in, NULL));
+         writeList().insert(tx_pair((base_transaction_object*)&in, 0));
       }
       //-----------------------------------------------------------------------
       // this isn't real memory, it's transactional memory. But the good news is,
@@ -1089,7 +1100,7 @@
          {
             if (j->second == (base_transaction_object*)&in)
             {
-               writeList().insert(tx_pair(j->first, NULL));
+               writeList().insert(tx_pair(j->first, 0));
                deletedMemoryList().push_back(j->first);
             }
          }
@@ -1329,6 +1340,7 @@
    size_t threadId_;
 
    light_auto_lock auto_general_lock_;
+   //locker<Mutex, transactionMutex_> transactionMutexLocker_;
 
    //--------------------------------------------------------------------------
    // ******** WARNING ******** MOVING threadId_ WILL BREAK TRANSACTION.
@@ -1491,6 +1503,16 @@
    inline static MutexSet ¤tlyLockedLocksRef(thread_id_t id) {return *threadCurrentlyLockedLocks_.find(id)->second;}
 #endif
 
+    static ThreadTransactionsStack threadTransactionsStack_;
+    TransactionsStack& transactionsRef_;
+   public:
+    inline TransactionsStack& transactions() {return transactionsRef_;}
+    inline static TransactionsStack &transactions(thread_id_t id) {
+        light_auto_lock auto_general_lock_(general_lock());
+        return *threadTransactionsStack_.find(id)->second;
+    }
+    private:
+
 ////////////////////////////////////////
 #else   // USE_SINGLE_THREAD_CONTEXT_MAP
 ////////////////////////////////////////
@@ -1627,6 +1649,15 @@
    inline static MutexSet ¤tlyLockedLocksRef(thread_id_t id) {return *threadCurrentlyLockedLocks_.find(id)->second;}
 #endif
 
+    static ThreadTransactionsStack threadTransactionsStack_;
+    TransactionsStack& transactionsRef_;
+   public:
+    inline TransactionsStack& transactions() {return transactionsRef_;}
+    inline static TransactionsStack &transactions(thread_id_t id) {
+        light_auto_lock auto_general_lock_(general_lock());
+        return *threadTransactionsStack_.find(id)->second;
+    }
+    private:
 
 ////////////////////////////////////////
 #endif
@@ -1649,6 +1680,36 @@
 
 
 
+public:
+    inline static transaction* current_transaction() {return transactions(THREAD_ID).top();}
+
+
+};
+
+inline transaction* current_transaction() {
+    return transaction::current_transaction();
+}
+
+template <typename MUTEX, MUTEX& mtx>
+locker<MUTEX,mtx>::locker() {
+    boost::stm::lock(mtx);
+}
+template <typename MUTEX, MUTEX& mtx>
+locker<MUTEX,mtx>::~locker() {}
+
+template <typename MUTEX, MUTEX& mtx>
+void locker<MUTEX,mtx>::unlock() {
+    boost::stm::unlock(mtx);
+}
+
+
+//-----------------------------------------------------------------------------
+// scoped thread initializer calling transaction::initialize_thread() in the
+// constructor and transaction::terminate_thread() in the destructor
+//-----------------------------------------------------------------------------
+struct thread_initializer {
+    thread_initializer() {transaction::initialize_thread();}
+    ~thread_initializer() {transaction::terminate_thread();}
 };
 
 #if 0
@@ -1679,24 +1740,38 @@
 // rand()+1 check is necessarily complex so smart compilers can't
 // optimize the if away
 //---------------------------------------------------------------------------
-#define use_atomic(T) if (0 != rand()+1) for (transaction T; !T.committed() && T.restart(); T.end())
-#define try_atomic(T) if (0 != rand()+1) for (transaction T; !T.committed() && T.restart(); T.no_throw_end()) try
-#define atomic(T)     if (0 != rand()+1) for (transaction T; !T.committed() && T.check_throw_before_restart() && T.restart_if_not_inflight(); T.no_throw_end()) try
+#ifdef BOOST_STM_COMPILER_DONT_DESTROY_FOR_VARIABLES
+#define use_atomic(T) if (0==rnd()+1) {} else for (boost::stm::transaction T; !T.committed() && T.restart(); T.end())
+#define try_atomic(T) if (0==rnd()+1) {} else for (boost::stm::transaction T; !T.committed() && T.restart(); T.no_throw_end()) try
+#define atomic(T)     if (0==rnd()+1) {} else for (boost::stm::transaction T; !T.committed() && T.check_throw_before_restart() && T.restart_if_not_inflight(); T.no_throw_end()) try
+#else
+#define use_atomic(T) for (boost::stm::transaction T; !T.committed() && T.restart(); T.end())
+#define try_atomic(T) for (boost::stm::transaction T; !T.committed() && T.restart(); T.no_throw_end()) try
+#define atomic(T)     for (boost::stm::transaction T; !T.committed() && T.check_throw_before_restart() && T.restart_if_not_inflight(); T.no_throw_end()) try
+#endif
 
 
+#define catch_before_retry(E) catch (boost::stm::aborted_tx &E)
+#define before_retry catch (boost::stm::aborted_tx &)
+#define end_atom catch (boost::stm::aborted_tx &) {}
 
-#define catch_before_retry(E) catch (aborted_tx &E)
-#define before_retry catch (aborted_tx &)
-#define end_atom catch (aborted_tx &) {}
+#define BOOST_STM_NEW(T, P) \
+    ((T).throw_if_forced_to_abort_on_new(), \
+    (T).as_new(new P))
+
+#define BOOST_STM_NEW_1(P) \
+    ((boost::stm::current_transaction()!=0)?BOOST_STM_NEW(*boost::stm::current_transaction(), P):new P)
+
+
+} // stm namespace
+} // boost namespace
 
-} // core namespace
-}
 #include <boost/stm/detail/transaction_impl.hpp>
 #include <boost/stm/detail/latm_general_impl.hpp>
 #include <boost/stm/detail/auto_lock.hpp>
 #include <boost/stm/detail/tx_ptr.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-#endif // TRANSACTION_H
+#endif // BOOST_STM_TRANSACTION__HPP
 
 
Added: sandbox/stm/boost/stm/tx/numeric.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/boost/stm/tx/numeric.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,99 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX_NUMERIC__HPP
+#define BOOST_STM_TX_NUMERIC__HPP
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+#include <boost/stm/transaction.hpp>
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+namespace boost { namespace stm { namespace tx {
+
+template <typename T>
+class numeric : public transaction_object< numeric<T> >
+{
+protected:
+    T val_;
+public:
+    //-----------------------------------------------------------------------------
+    numeric() : val_(0) {}
+
+    //
+    template<class U>
+    numeric(numeric<U> const& r) : val_(r.value()) {}
+
+    // contructor from a implicitly convertible to T
+    template <typename U>
+    numeric(U v) : val_(v) {}
+    //numeric(T v) : val_(v) {}
+    ~numeric() {}
+
+    #if 0
+    template<class U>
+    numeric& operator=(numeric<U> const& r) {
+        val_=r.value();
+    }
+    #endif
+
+    operator T() const { return value(); }
+    operator T&() { return ref(); }
+
+    T& ref() {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+
+            return tx->write(*this).val_;
+        }
+        return val_;
+    }
+
+    T value() const {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+            return tx->read(*this).val_;
+        }
+        return val_;
+    }
+
+};
+
+
+typedef numeric<bool> boolean;
+
+typedef numeric<char> char_t;
+typedef numeric<unsigned char> uchar_t;
+typedef numeric<short> short_t;
+typedef numeric<unsigned short> ushort_t;
+typedef numeric<int> int_t;
+typedef numeric<unsigned int> uint_t;
+typedef numeric<long> long_t;
+typedef numeric<unsigned long> ulong_t;
+
+typedef numeric<float> float_t;
+typedef numeric<double> double_t;
+
+}}}
+#endif
+
+
Added: sandbox/stm/boost/stm/tx/pointer.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/boost/stm/tx/pointer.hpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,170 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX_POINTER__HPP
+#define BOOST_STM_TX_POINTER__HPP
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+#include <boost/stm/transaction.hpp>
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+namespace boost { namespace stm { namespace tx {
+
+//-----------------------------------------------------------------------------
+// class pointer wraps a transactional_object providing builting operators
+//-----------------------------------------------------------------------------
+
+template <typename T>
+class pointer : public transaction_object< pointer<T> >
+{
+protected:
+    T* val_;
+public:
+    //-----------------------------------------------------------------------------
+    pointer() : val_(0) {}
+
+    //
+    template<class U>
+    pointer(pointer<U> const& r) : val_(r.value()) {}
+
+    // contructor from a implicitly convertible to T
+    template <typename U>
+    pointer(U* v) : val_(v) {}
+    pointer(T* v) : val_(v) {}
+    //
+    ~pointer() {}
+
+    operator T*() const { return get(); }
+    operator T*&() { return get(); }
+
+    T*& get() {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+
+            return tx->write(*this).val_;
+        }
+        return val_;
+    }
+
+    T const * get() const {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+            return tx->read(*this).val_;
+        }
+        return val_;
+    }
+
+    T const * operator->() const {
+        return this->get();
+    }
+    T const & operator*() const {
+        return *this->get();
+    }
+
+    T * operator->() {
+        return this->get();
+    }
+    T & operator*() {
+        return *this->get();
+    }
+
+};
+
+template <typename C, typename R>
+class pointer_to_member : public transaction_object< pointer_to_member<C,R> >
+{
+protected:
+    R C::* val_;
+public:
+    //-----------------------------------------------------------------------------
+    pointer_to_member() : val_(0) {}
+
+    //
+    pointer_to_member(pointer_to_member const& r) : val_(r.value()) {}
+
+    // contructor from a implicitly convertible to T
+    pointer_to_member(R C::* v) : val_(v) {}
+    //
+
+    operator R C::*() const { return get(); }
+    operator R C::*&() { return get(); }
+
+    R C::*& get() {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+
+            return tx->write(*this).val_;
+        }
+        return val_;
+    }
+
+    R C::* const * get() const {
+        transaction* tx=current_transaction();
+        if (tx!=0) {
+            if (tx->forced_to_abort()) {
+                tx->lock_and_abort();
+                throw aborted_transaction_exception("aborting transaction");
+            }
+            return tx->read(*this).val_;
+        }
+        return val_;
+    }
+
+};
+
+#if 0
+
+// two transactional pointers are equal if they point to the same cache on the current transaction.
+template <typename T, typename U>
+inline bool operator==(const pointer<T>& lhs, const pointer<U>& rhs) {
+    return lhs.ref()==rhs.ref();
+}
+
+template <typename T, typename U>
+inline bool operator==(const T& lhs, const pointer<U>& rhs) {
+    return lhs==rhs.ref();
+}
+
+template <typename T, typename U>
+inline bool operator==(const pointer<T>& lhs, const U& rhs) {
+    return lhs.ref()==rhs;
+}
+
+template <typename T, typename U>
+inline bool operator!=(const pointer<T>& lhs, const pointer<U>& rhs) {
+    return lhs.ref()!=rhs.ref();
+}
+
+template<class T> inline void swap(pointer<T> & a, pointer<T> & b) {
+    a.swap(b);
+}
+#endif
+
+}}}
+#endif
+
+
Added: sandbox/stm/libs/stm/example/numeric.cpp
==============================================================================
--- (empty file)
+++ sandbox/stm/libs/stm/example/numeric.cpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,230 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/stm.hpp>
+#include <boost/thread.hpp>
+#include <vector>
+#include <assert.h>
+#include <list>
+#include <iostream>
+#include <stdlib.h>
+
+using namespace std;
+using namespace boost;
+
+stm::tx::int_t counter(0);
+stm::tx::int_t counter2(0);
+
+struct A {
+    A() : i(0), ptr(&i) {}
+    stm::tx::int_t i;
+    stm::tx::pointer<stm::tx::int_t> const ptr;
+};
+
+struct B {
+    B() : a_ptr() {}
+    stm::tx::pointer<A> a_ptr;
+};
+
+
+A a;
+B b;
+
+bool test_ptr() {
+    {
+    const stm::tx::numeric<int> ci=10;
+    const stm::tx::numeric<int> cj = 10;
+    stm::tx::pointer<const stm::tx::numeric<int> > pc = &ci;
+    stm::tx::pointer<const stm::tx::numeric<int> > pc2 = &cj;
+    pc=&cj;
+    stm::tx::pointer<const stm::tx::numeric<int> > const cpc = pc;
+    //cpc=pc2; // this must not compile
+    stm::tx::pointer<stm::tx::pointer<const stm::tx::numeric<int> > > ppc;
+    }
+    {
+    const int ci=10;
+    const int cj = 10;
+    stm::tx::pointer<const int> pc = &ci;
+    stm::tx::pointer<const int> pc2 = &cj;
+    pc=&cj;
+    stm::tx::pointer<const int> const cpc = pc;
+    //cpc=pc2; // this must not compile
+    stm::tx::pointer<stm::tx::pointer<const int> > ppc;
+    }
+
+    stm::tx::numeric<int> i;
+    stm::tx::pointer<stm::tx::numeric<int> > p;
+    stm::tx::pointer<stm::tx::numeric<int> > const cp = &i;
+
+    use_atomic(_) {
+        b.a_ptr=&a;
+        b.a_ptr->i =1;
+    }
+    bool res;
+    use_atomic(_) {
+        res =(b.a_ptr->i==1)&&(*b.a_ptr->ptr==1);
+    }
+    return res;
+}
+
+bool test_array() {
+    {
+    int v[2];
+    int * p;
+    p = &v[0];
+    p = v;
+    ++p;
+    }
+    stm::tx::numeric<int> v[2];
+    stm::tx::pointer<stm::tx::numeric<int> > p;
+    p = &v[0];
+    p = v;
+    ++p;
+    bool res=true;
+    return res;
+}
+
+void inc() {
+    stm::thread_initializer thi;
+
+    use_atomic(_) {
+        ++counter;
+    }
+}
+void inc1() {
+    stm::thread_initializer thi;
+
+    use_atomic(_) {
+        counter+=1;
+    }
+}
+void decr() {
+    stm::thread_initializer thi;
+
+    use_atomic(_) {
+        --counter;
+    }
+}
+bool check(int val) {
+    //thread_initializer thi;
+    bool res;
+    use_atomic(_) {
+        res =(counter==val);
+    }
+    return res;
+}
+
+bool test_equal() {
+    //thread_initializer thi;
+    use_atomic(_) {
+        counter=1;
+        counter2=2;
+    }
+    bool res;
+    use_atomic(_) {
+        counter=2;
+        //assert(counter==counter2);
+        res =(counter==counter2);
+    }
+    return res;
+}
+
+bool test_assign() {
+    //thread_initializer thi;
+    use_atomic(_) {
+        counter=1;
+        counter2=counter;
+    }
+    bool res;
+    use_atomic(_) {
+        //assert((counter==1) && (counter2==1) && (counter==counter2));
+        res =(counter==1) && (counter2==1) && (counter==counter2) ;
+    }
+    return res;
+}
+
+bool test_less() {
+    //thread_initializer thi;
+    use_atomic(_) {
+        counter=1;
+        counter2=2;
+    }
+    bool res;
+    use_atomic(_) {
+        //assert(counter<counter2);
+        res =(counter<counter2) ;
+    }
+    return res;
+}
+
+bool test_le() {
+    //thread_initializer thi;
+    use_atomic(_) {
+        counter=1;
+        counter2=1;
+    }
+    bool res;
+    use_atomic(_) {
+        //assert(counter<=counter2);
+        res =(counter<=counter2) ;
+    }
+    return res;
+}
+bool test_const(stm::tx::numeric<int> const& c) {
+    //thread_initializer thi;
+    use_atomic(_) {
+        counter2=c;
+    }
+    bool res;
+    use_atomic(_) {
+        //assert(c==counter2);
+        res =(c==counter2) ;
+    }
+    return res;
+}
+
+int test_counter() {
+
+    int fails=0;
+    #if 1
+    thread  th1(inc);
+    thread  th2(decr);
+    thread  th3(inc1);
+    thread  th4(inc);
+
+    th1.join();
+    th2.join();
+    th3.join();
+    th4.join();
+
+    fails += !check(2);
+    #endif
+    fails += !test_equal();
+    fails += !test_assign();
+    fails += !test_less();
+    fails += !test_le();
+    fails += !test_ptr();
+    fails += !test_const(counter);
+    std::cout << "fails=" << fails << std::endl;
+    return fails;
+}
+
+int main() {
+    stm::transaction::enable_dynamic_priority_assignment();
+    stm::transaction::do_deferred_updating();
+    stm::transaction::initialize();
+    stm::thread_initializer thi;
+
+    return test_counter();
+
+}
Modified: sandbox/stm/libs/stm/src/transaction.cpp
==============================================================================
--- sandbox/stm/libs/stm/src/transaction.cpp	(original)
+++ sandbox/stm/libs/stm/src/transaction.cpp	2009-10-16 22:46:44 EDT (Fri, 16 Oct 2009)
@@ -1,13 +1,13 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (C) Copyright Justin E. Gottchlich 2009. 
-// (C) Copyright Vicente J. Botet Escriba 2009. 
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
 // Distributed under the Boost
-// Software License, Version 1.0. 
-// (See accompanying file LICENSE_1_0.txt or 
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
 // copy at http://www.boost.org/LICENSE_1_0.txt)
 //
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
@@ -27,6 +27,7 @@
 transaction::MutexThreadMap transaction::latmLockedLocksOfThreadMap_;
 transaction::MutexSet transaction::tmConflictingLocks_;
 transaction::DeletionBuffer transaction::deletionBuffer_;
+transaction::ThreadTransactionsStack transaction::threadTransactionsStack_;
 
 size_t transaction::global_clock_ = 0;
 size_t transaction::stalls_ = 0;
@@ -61,7 +62,7 @@
 // second param = sleepIncrease factor (initialSleepTime * factor)
 // third param = # of increases before resetting
 ///////////////////////////////////////////////////////////////////////////////
-base_contention_manager *transaction::cm_ = 
+base_contention_manager *transaction::cm_ =
     new ExceptAndBackOffOnAbortNoticeCM(0, 0, 0);
 //    new DefaultContentionManager();
 //    new NoExceptionOnAbortNoticeOnReadWritesCM();
@@ -110,7 +111,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // static initialization method - must be called before the transaction
 // class is used because it initializes our transactionMutex_ which is used
-// to guarantee a consistent state of the static 
+// to guarantee a consistent state of the static
 // transactionsInFlight_<transaction* > is correct.
 ///////////////////////////////////////////////////////////////////////////////
 void transaction::initialize()
@@ -125,10 +126,10 @@
 #ifndef BOOST_STM_USE_BOOST_MUTEX
    //pthread_mutexattr_settype(&transactionMutexAttribute_, PTHREAD_MUTEX_NORMAL);
 
-   pthread_mutex_init(&transactionMutex_, NULL);
-   pthread_mutex_init(&transactionsInFlightMutex_, NULL);
-   pthread_mutex_init(&deletionBufferMutex_, NULL);
-   pthread_mutex_init(&latmMutex_, NULL);
+   pthread_mutex_init(&transactionMutex_, 0);
+   pthread_mutex_init(&transactionsInFlightMutex_, 0);
+   pthread_mutex_init(&deletionBufferMutex_, 0);
+   pthread_mutex_init(&latmMutex_, 0);
 
    //pthread_mutex_init(&transactionMutex_, &transactionMutexAttribute_);
    //pthread_mutex_init(&transactionsInFlightMutex_, &transactionMutexAttribute_);
@@ -152,16 +153,16 @@
    //
    //          In order to make end_transaction as efficient as possible, we
    //          must release general_access() before we release the specific
-   //          threaded mutexes. Unfortunately, because of this, a thread can 
+   //          threaded mutexes. Unfortunately, because of this, a thread can
    //          can enter this function and add a new thread (and mutex) to the
    //          mutex list. Then end_transaction() can finish its execution and
    //          unlock all mutexes. The problem is that between end_transaction
    //          and this function, any number of operations can be performed.
    //          One of those operations may lock the mutex of the new thread,
-   //          which may then be unlocked by end_transaction. If that happens, 
+   //          which may then be unlocked by end_transaction. If that happens,
    //          all kinds of inconsistencies could occur ...
    //
-   //          In order to fix this, we could change the unlock order of 
+   //          In order to fix this, we could change the unlock order of
    //          end_transaction() so it unlocks all mutexes before releasing the
    //          the general mutex. The problem with that is end_transaction is
    //          a high serialization point and the general mutex is the most
@@ -181,7 +182,7 @@
    size_t threadId = THREAD_ID;
 
 #ifndef USE_SINGLE_THREAD_CONTEXT_MAP
-/////////////////////////////////    
+/////////////////////////////////
    ThreadWriteContainer::iterator writeIter = threadWriteLists_.find(threadId);
    ThreadReadContainer::iterator readIter = threadReadLists_.find(threadId);
    ThreadBloomFilterList::iterator bloomIter = threadBloomFilterLists_.find(threadId);
@@ -190,7 +191,7 @@
    ThreadMemoryContainerList::iterator newMemIter = threadNewMemoryLists_.find(threadId);
    ThreadMemoryContainerList::iterator deletedMemIter = threadDeletedMemoryLists_.find(threadId);
    ThreadTxTypeContainer::iterator txTypeIter = threadTxTypeLists_.find(threadId);
-   ThreadBoolContainer::iterator abortIter = threadForcedToAbortLists_.find(threadId);  
+   ThreadBoolContainer::iterator abortIter = threadForcedToAbortLists_.find(threadId);
    ThreadMutexContainer::iterator mutexIter = threadMutexes_.find(threadId);
    ThreadBoolContainer::iterator blockedIter = threadBlockedLists_.find(threadId);
 #if PERFORMING_LATM
@@ -214,6 +215,11 @@
       threadCurrentlyLockedLocks_[threadId] = new MutexSet;
    }
 #endif
+   ThreadTransactionsStack::iterator transactionsdIter = threadTransactionsStack_.find(threadId);
+   if (threadTransactionsStack_.end() == transactionsdIter)
+   {
+      threadTransactionsStack_[threadId] = new TransactionsStack;
+   }
 
    if (threadWriteLists_.end() == writeIter)
    {
@@ -262,23 +268,23 @@
    {
       Mutex *mutex = new Mutex;
 #ifndef BOOST_STM_USE_BOOST_MUTEX
-#if WIN32      
+#if WIN32
       *mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif       
-      pthread_mutex_init(mutex, NULL);
+#endif
+      pthread_mutex_init(mutex, 0);
 #endif
       threadMutexes_.insert(thread_mutex_pair(threadId, mutex));
       mutexIter = threadMutexes_.find(threadId);
    }
-   
+
    if (threadBlockedLists_.end() == blockedIter)
    {
       threadBlockedLists_.insert(thread_bool_pair(threadId, new int(0)));
    }
-   
-//////////////////////////////////////   
+
+//////////////////////////////////////
 #else
-   
+
    ThreadMutexContainer::iterator mutexIter = threadMutexes_.find(threadId);
    ThreadBoolContainer::iterator blockedIter = threadBlockedLists_.find(threadId);
 #if PERFORMING_LATM
@@ -303,19 +309,25 @@
    }
 #endif
 
+   ThreadTransactionsStack::iterator transactionsdIter = threadTransactionsStack_.find(threadId);
+   if (threadTransactionsStack_.end() == transactionsdIter)
+   {
+      threadTransactionsStack_[threadId] = new TransactionsStack;
+   }
+
    if (threadMutexes_.end() == mutexIter)
    {
       Mutex *mutex = new Mutex;
 #ifndef BOOST_STM_USE_BOOST_MUTEX
-#if WIN32      
+#if WIN32
       *mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif       
-      pthread_mutex_init(mutex, NULL);
+#endif
+      pthread_mutex_init(mutex, 0);
 #endif
       threadMutexes_.insert(thread_mutex_pair(threadId, mutex));
       mutexIter = threadMutexes_.find(threadId);
    }
-   
+
    if (threadBlockedLists_.end() == blockedIter)
    {
       threadBlockedLists_.insert(thread_bool_pair(threadId, new int(0)));
@@ -328,7 +340,7 @@
       memIter = tss_context_map_.find(threadId);
       memIter->second->txType = eNormalTx;
    }
-   
+
 #endif
 
    //--------------------------------------------------------------------------
@@ -342,16 +354,16 @@
    //
    //          In order to make end_transaction as efficient as possible, we
    //          must release general_access() before we release the specific
-   //          threaded mutexes. Unfortunately, because of this, a thread can 
+   //          threaded mutexes. Unfortunately, because of this, a thread can
    //          can enter this function and add a new thread (and mutex) to the
    //          mutex list. Then end_transaction() can finish its execution and
    //          unlock all mutexes. The problem is that between end_transaction
    //          and this function, any number of operations can be performed.
    //          One of those operations may lock the mutex of the new thread,
-   //          which may then be unlocked by end_transaction. If that happens, 
+   //          which may then be unlocked by end_transaction. If that happens,
    //          all kinds of inconsistencies could occur ...
    //
-   //          In order to fix this, we could change the unlock order of 
+   //          In order to fix this, we could change the unlock order of
    //          end_transaction() so it unlocks all mutexes before releasing the
    //          the general mutex. The problem with that is end_transaction is
    //          a high serialization point and the general mutex is the most
@@ -389,7 +401,8 @@
    ThreadBloomFilterList::iterator wbloomIter = threadWBloomFilterLists_.find(threadId);
    ThreadTxTypeContainer::iterator txTypeIter = threadTxTypeLists_.find(threadId);
    ThreadBoolContainer::iterator abortIter = threadForcedToAbortLists_.find(threadId);
-
+   ThreadTransactionsStack::iterator transactionsdIter = threadTransactionsStack_.find(threadId);
+   delete transactionsdIter->second;
    delete writeIter->second;
    delete readIter->second;
    delete bloomIter->second;
@@ -411,16 +424,16 @@
    threadForcedToAbortLists_.erase(abortIter);
 
    ThreadMutexContainer::iterator mutexIter = threadMutexes_.find(threadId);
-#ifndef BOOST_STM_USE_BOOST_MUTEX   
+#ifndef BOOST_STM_USE_BOOST_MUTEX
    pthread_mutex_destroy(mutexIter->second);
-#endif   
+#endif
    delete mutexIter->second;
    threadMutexes_.erase(mutexIter);
 
 #ifndef MAP_THREAD_MUTEX_CONTAINER
    {
    // realign all in-flight transactions so they are accessing the correct mutex
-   for (InflightTxes::iterator i = transactionsInFlight_.begin(); 
+   for (InflightTxes::iterator i = transactionsInFlight_.begin();
       i != transactionsInFlight_.end(); ++i)
    {
       transaction* t = *i;
@@ -450,7 +463,7 @@
    threadCurrentlyLockedLocks_.erase(currentlyLockedLocksIter);
 #endif
 
-   
+
 #else
    tss_context_map_type::iterator memIter = tss_context_map_.find(threadId);
    delete memIter->second;
@@ -463,7 +476,7 @@
 #ifndef MAP_THREAD_BOOL_CONTAINER
    {
    // realign all in-flight transactions so they are accessing the correct mutex
-   for (InflightTxes::iterator i = transactionsInFlight_.begin(); 
+   for (InflightTxes::iterator i = transactionsInFlight_.begin();
       i != transactionsInFlight_.end(); ++i)
    {
       transaction* t = *i;
@@ -473,7 +486,7 @@
    }
    }
 #endif
-      
+
    unlock_inflight_access();
    unlock_general_access();
 }