$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r57221 - in sandbox/stm/branches/vbe: boost/stm boost/stm/detail boost/stm/latm libs/stm/src libs/stm/test
From: vicente.botet_at_[hidden]
Date: 2009-10-29 05:27:29
Author: viboes
Date: 2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
New Revision: 57221
URL: http://svn.boost.org/trac/boost/changeset/57221
Log:
TBoost.STM vbe: 
* Continue moving LATM specificities to latm directory and namespace
* changing the prototype of pthread_lock/unlock to a void function to conform with the lockable concept
Added:
   sandbox/stm/branches/vbe/boost/stm/latm/dynamic_mode.hpp
      - copied, changed from r57154, /sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp
   sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp
      - copied, changed from r57154, /sandbox/stm/branches/vbe/boost/stm/latm/full.hpp
Removed:
   sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp
   sandbox/stm/branches/vbe/boost/stm/latm/full.hpp
Text files modified: 
   sandbox/stm/branches/vbe/boost/stm/detail/config.hpp                          |    16 ++                                      
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_full_impl.hpp              |    42 +++---                                  
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tm_impl.hpp                |    50 ++++----                                
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tx_impl.hpp                |    42 +++---                                  
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp              |    46 ++++----                                
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp                |    56 +++++-----                              
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp                |    44 ++++----                                
   sandbox/stm/branches/vbe/boost/stm/detail/latm_general_impl.hpp               |    63 ++++++-----                             
   sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp                |     9                                         
   sandbox/stm/branches/vbe/boost/stm/latm/base_mode.hpp                         |    52 ++++++---                               
   sandbox/stm/branches/vbe/boost/stm/latm/datatypes.hpp                         |     1                                         
   sandbox/stm/branches/vbe/boost/stm/latm/dynamic_mode.hpp                      |    97 +++--------------                       
   sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp                         |    96 ++++++++++++-----                       
   sandbox/stm/branches/vbe/boost/stm/latm/selector.hpp                          |    12 +                                       
   sandbox/stm/branches/vbe/boost/stm/transaction.hpp                            |    88 ++++++---------                         
   sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp                         |    36 +++++-                                  
   sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2                             |   214 +++++++++++++++++++++++++++++++-------- 
   sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp       |   114 ++++++++++++--------                    
   sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp                         |     8                                         
   sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp                         |     4                                         
   sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp                          |     6                                         
   sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp                        |     2                                         
   sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp |     3                                         
   sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp               |     2                                         
   sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp                        |     2                                         
   sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.h                          |     7 -                                       
   sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp                       |     4                                         
   sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h                          |     4                                         
   28 files changed, 642 insertions(+), 478 deletions(-)
Modified: sandbox/stm/branches/vbe/boost/stm/detail/config.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/config.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/config.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -116,6 +116,22 @@
 
 #define BOOST_STM_USE_BOOST_SYNCHRO 1
 
+///////////////////////////////////////////////////////////////////////////////
+// BOOST_STM_LATM_STATIC_MODE
+// BOOST_STM_LATM_STATIC_FULL_MODE
+// BOOST_STM_LATM_STATIC_TM_MODE
+// BOOST_STM_LATM_STATIC_TX_MODE
+// BOOST_STM_LATM_DYNAMIC_MODE
+
+//#define BOOST_STM_LATM_STATIC_FULL_MODE 1
+//#define BOOST_STM_LATM_STATIC_TM_MODE 1
+//#define BOOST_STM_LATM_STATIC_TX_MODE 1
+//#define BOOST_STM_LATM_DYNAMIC_MODE 1
+
+#if defined(BOOST_STM_LATM_STATIC_FULL_MODE) || defined(BOOST_STM_LATM_STATIC_TM_MODE) || defined(BOOST_STM_LATM_STATIC_TX_MODE)
+#define BOOST_STM_LATM_STATIC_MODE 1
+#endif
+
 #endif // BOOST_STM_DETAIL_CONFIG_H
 
 
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_def_full_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_def_full_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_def_full_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -56,7 +56,7 @@
    // if the lock-aware tm lock set is empty, lock the in-flight trans mutex
    // so we can abort all the in-flight transactions
    //--------------------------------------------------------------------------
-   if (latmLockedLocks_.empty())
+   if (latm::instance().latmLockedLocks_.empty())
    {
       synchro::lock_guard<Mutex> lock_g(*general_lock());
       //synchro::lock(*general_lock());
@@ -91,7 +91,7 @@
       //synchro::unlock(*inflight_lock());
    }
 
-   try { latmLockedLocks_.insert(mutex); }
+   try { latm::instance().latmLockedLocks_.insert(mutex); }
    catch (...)
    {
       synchro::unlock(*inflight_lock());
@@ -104,7 +104,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_full_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_full_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
@@ -117,15 +117,15 @@
       t->commit_deferred_update_tx();
        { synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
        }
 
       // TBR if (hadLock) return 0;
       // TBR else return lock(mutex);
-      if (hadLock) return 0;
+      if (hadLock) return;
       else synchro::lock(*mutex);
-      return 0;
+      return;
    }
 
    int waitTime = 0, aborted = 0;
@@ -136,7 +136,7 @@
       //{
       synchro::lock(*mutex);
       //synchro::lock_guard<Mutex> lock_m(*mutex);
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
       //synchro::lock_guard<Mutex> lock_l(latmMutex_);
       try
       {
@@ -148,7 +148,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -156,7 +156,7 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       //}
 
       SLEEP(cm_lock_sleep_time());
@@ -164,9 +164,9 @@
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
-   return 0;
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -185,7 +185,7 @@
       t->commit_deferred_update_tx();
        { synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
        }
 
@@ -198,7 +198,7 @@
    if (!synchro::try_lock(*mutex)) return 1;
 
    //synchro::lock(latmMutex_);
-    synchro::lock_guard<Mutex> lock_l(latmMutex_);
+    synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
 
    try
    {
@@ -219,7 +219,7 @@
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    //synchro::unlock(latmMutex_);
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
@@ -229,10 +229,10 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_full_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_full_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
    bool hasLock = true;
-   { synchro::lock_guard<Mutex> lock_l(latmMutex_);
+   { synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
     //synchro::lock(latmMutex_);
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
@@ -249,18 +249,18 @@
       t->remove_from_currently_locked_locks(mutex);
    }
 
-   latmLockedLocks_.erase(mutex);
+   latm::instance().latmLockedLocks_.erase(mutex);
 
-   if (latmLockedLocks_.empty()) synchro::unlock(*inflight_lock());
+   if (latm::instance().latmLockedLocks_.empty()) synchro::unlock(*inflight_lock());
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
    //synchro::unlock(latmMutex_);
    }
 
    // TBR if (hasLock) return unlock(mutex);
    // TBR else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 
 }}
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tm_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tm_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tm_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -58,11 +58,11 @@
    //
    // if it isn't we don't interrupt any in-flight transactions
    //--------------------------------------------------------------------------
-   if (tmConflictingLocks_.find(mutex) != tmConflictingLocks_.end())
+   if (latm::instance().tmConflictingLocks_.find(mutex) != latm::instance().tmConflictingLocks_.end())
    {
       // if the lock-aware tm lock set is empty, lock the in-flight trans mutex
       // so we can abort all the in-flight transactions
-      if (latmLockedLocks_.empty())
+      if (latm::instance().latmLockedLocks_.empty())
       {
          synchro::lock_guard<Mutex> autolock_g(*general_lock());
          synchro::lock_guard<Mutex> autolock_i(*inflight_lock());
@@ -88,7 +88,7 @@
          }
       }
 
-      latmLockedLocks_.insert(mutex);
+      latm::instance().latmLockedLocks_.insert(mutex);
    }
 
    return true;
@@ -97,11 +97,11 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
-      transaction::must_be_in_tm_conflicting_lock_set(mutex);
+      latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       t->commit_deferred_update_tx();
 
@@ -111,15 +111,15 @@
       {
           synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
       }
 
       // TBR if (hadLock) return 0;
       // TBR else return lock(mutex);
-      if (hadLock) return 0;
+      if (hadLock) return;
       else synchro::lock(*mutex);
-      return 0;
+      return;
    }
 
    int waitTime = 0, aborted = 0;
@@ -132,7 +132,7 @@
        //synchro::lock_guard<Mutex> lock_m(*latm_lock());
        //synchro::lock_guard<Mutex> lock_l(latmMutex_);
        synchro::lock(*mutex);
-       synchro::lock(latmMutex_);
+       synchro::lock(latm::instance().latmMutex_);
 
       try
       {
@@ -145,7 +145,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -153,7 +153,7 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       //}
 
       SLEEP(cm_lock_sleep_time());
@@ -161,10 +161,10 @@
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
-   return 0;
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -174,7 +174,7 @@
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
-      transaction::must_be_in_tm_conflicting_lock_set(mutex);
+      latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       t->commit_deferred_update_tx();
 
@@ -184,7 +184,7 @@
       {
       synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
       }
 
@@ -200,7 +200,7 @@
    if (!synchro::try_lock(*mutex)) return 1;
 
    //synchro::lock(latmMutex_);
-   synchro::lock_guard<Mutex> lock_l(latmMutex_);
+   synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
 
    try
    {
@@ -221,7 +221,7 @@
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    //synchro::unlock(latmMutex_);
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
@@ -231,11 +231,11 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
    bool hasLock = true;
    {
-   synchro::lock_guard<Mutex> lock_l(latmMutex_);
+   synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
    //synchro::lock(latmMutex_);
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
@@ -257,21 +257,21 @@
    // it from the latmLocks and check to see if we allow transactions to
    // continue.
    //--------------------------------------------------------------------------
-   if (tmConflictingLocks_.find(mutex) != tmConflictingLocks_.end())
+   if (latm::instance().tmConflictingLocks_.find(mutex) != latm::instance().tmConflictingLocks_.end())
    {
-      latmLockedLocks_.erase(mutex);
+      latm::instance().latmLockedLocks_.erase(mutex);
 
-      if (latmLockedLocks_.empty()) synchro::unlock(*inflight_lock());
+      if (latm::instance().latmLockedLocks_.empty()) synchro::unlock(*inflight_lock());
    }
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
    //synchro::unlock(latmMutex_);
    }
 
    // TBR if (hasLock) return unlock(mutex);
    // TBR else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 
 }}
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tx_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tx_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tx_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -93,7 +93,7 @@
       }
 
       try {
-         latmLockedLocksAndThreadIdsMap_.insert
+         latm::instance().latmLockedLocksAndThreadIdsMap_.insert
          (std::make_pair<latm::mutex_type*, ThreadIdSet>(mutex, txThreadId));
       }
       catch (...)
@@ -121,7 +121,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    int waitTime = 0, aborted = 0;
 
@@ -159,12 +159,12 @@
       t->add_to_obtained_locks(mutex);
       t->commit_deferred_update_tx();
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
       def_do_core_tx_conflicting_lock_pthread_lock_mutex
          (mutex, 0, 0, true);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
 
-      return 0;
+      return;
    }
 
    for (;;)
@@ -172,7 +172,7 @@
       synchro::lock(*mutex); // TBR int val = lock(mutex);
       // TBR if (0 != val) return val;
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
 
       try
       {
@@ -185,7 +185,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -193,19 +193,19 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
 
       SLEEP(cm_lock_sleep_time());
       waitTime += cm_lock_sleep_time();
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
-   return 0;
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -223,7 +223,7 @@
    //if (0 != val) return val;
    if (!synchro::try_lock(*mutex)) return 1;
 
-   synchro::lock(latmMutex_);
+   synchro::lock(latm::instance().latmMutex_);
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
@@ -242,19 +242,19 @@
       if (!def_do_core_tx_conflicting_lock_pthread_lock_mutex(mutex, 0, 0, txIsIrrevocable))
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          return -1;
       }
    }
    catch (...)
    {
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
@@ -264,7 +264,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::def_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::def_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
    synchro::lock_guard<Mutex> autolock_l(*latm_lock());
    synchro::lock_guard<Mutex> autolock_g(*general_lock());
@@ -290,13 +290,13 @@
    // it from the latmLocks and any txs on the full thread list that are
    // blocked because of this lock being locked should be unblocked
    //--------------------------------------------------------------------------
-   if (latmLockedLocksAndThreadIdsMap_.find(mutex) != latmLockedLocksAndThreadIdsMap_.end())
+   if (latm::instance().latmLockedLocksAndThreadIdsMap_.find(mutex) != latm::instance().latmLockedLocksAndThreadIdsMap_.end())
    {
 #if LOGGING_BLOCKS
       logFile_ << "----------------------\nbefore unlocked mutex: " << mutex << endl << endl;
       logFile_ << outputBlockedThreadsAndLockedLocks() << endl;
 #endif
-      latmLockedLocksAndThreadIdsMap_.erase(mutex);
+      latm::instance().latmLockedLocksAndThreadIdsMap_.erase(mutex);
       unblock_conflicting_threads(mutex);
 
 #if LOGGING_BLOCKS
@@ -305,13 +305,13 @@
 #endif
    }
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
    unblock_threads_if_locks_are_empty();
 
    // TBR if (hasLock) return unlock(mutex);
    // TBR else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 
 }}
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -56,7 +56,7 @@
    // if the lock-aware tm lock set is empty, lock the in-flight trans mutex
    // so we can abort all the in-flight transactions
    //--------------------------------------------------------------------------
-   if (latmLockedLocks_.empty())
+   if (latm::instance().latmLockedLocks_.empty())
    {
        
     //{
@@ -106,7 +106,7 @@
    }
 
    try { 
-       latmLockedLocks_.insert(mutex); }
+       latm::instance().latmLockedLocks_.insert(mutex); }
    catch (...)
    {
        // BUG ???
@@ -121,7 +121,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_full_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_full_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
@@ -133,12 +133,12 @@
 
       // this method locks LATM and keeps it locked upon returning if param true
       wait_until_all_locks_are_released(true);
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
 
-      if (hadLock) return 0;
+      if (hadLock) return;
       else synchro::lock(*mutex);
-      return 0;
+      return;
    }
 
    int waitTime = 0, aborted = 0;
@@ -150,7 +150,7 @@
       synchro::lock(*mutex);
       //synchro::lock_guard<Mutex> lock_m(*mutex);
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
       //synchro::lock_guard<Mutex> lock_l(latmMutex_);
 
       try
@@ -163,7 +163,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -171,7 +171,7 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
         //}
 
       SLEEP(cm_lock_sleep_time());
@@ -179,9 +179,9 @@
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
-   return 0;
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -199,7 +199,7 @@
 
       // this method locks LATM and keeps it locked upon returning if param true
       wait_until_all_locks_are_released(true);
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
 
       if (hadLock) return 0;
@@ -213,7 +213,7 @@
    if (!synchro::try_lock(*mutex)) return 1;
 
    //synchro::lock(latmMutex_);
-   synchro::lock_guard<Mutex> lock_l(latmMutex_);
+   synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
 
    try
    {
@@ -223,18 +223,18 @@
       if (!dir_do_core_full_pthread_lock_mutex(mutex, 0, 0))
       {
          //synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          return -1;
       }
    }
    catch (...)
    {
       //synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    //synchro::unlock(latmMutex_);
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
@@ -244,12 +244,12 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_full_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_full_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
    bool hasLock = true;
     {
    //synchro::lock(latmMutex_);
-   synchro::lock_guard<Mutex> lock_l(latmMutex_);
+   synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
@@ -265,9 +265,9 @@
       t->remove_from_currently_locked_locks(mutex);
    }
 
-   latmLockedLocks_.erase(mutex);
+   latm::instance().latmLockedLocks_.erase(mutex);
 
-   if (latmLockedLocks_.empty())
+   if (latm::instance().latmLockedLocks_.empty())
    {
       synchro::lock_guard<Mutex> lock_l(*general_lock());
       //synchro::lock(*general_lock());
@@ -277,13 +277,13 @@
       //synchro::unlock(*general_lock());
    }
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
    //synchro::unlock(latmMutex_);
     }
    // TBR if (hasLock) return unlock(mutex);
    // TBR else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 
 }}
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -58,13 +58,13 @@
    //
    // if it isn't we don't interrupt any in-flight transactions
    //--------------------------------------------------------------------------
-   if (tmConflictingLocks_.find(mutex) != tmConflictingLocks_.end())
+   if (latm::instance().tmConflictingLocks_.find(mutex) != latm::instance().tmConflictingLocks_.end())
    {
       //--------------------------------------------------------------------------
       // if the lock-aware tm lock set is empty, lock the in-flight trans mutex
       // so we can abort all the in-flight transactions
       //--------------------------------------------------------------------------
-      if (latmLockedLocks_.empty())
+      if (latm::instance().latmLockedLocks_.empty())
       {
          synchro::lock(*general_lock());
          synchro::lock(*inflight_lock());
@@ -108,7 +108,7 @@
          while (!transactionsInFlight_.empty()) { SLEEP(10); }
       }
 
-      latmLockedLocks_.insert(mutex);
+      latm::instance().latmLockedLocks_.insert(mutex);
    }
 
    return true;
@@ -117,17 +117,17 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
-      transaction::must_be_in_tm_conflicting_lock_set(mutex);
+      latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
       synchro::lock(*mutex);
-      return 0;
+      return;
    }
 
    int waitTime = 0, aborted = 0;
@@ -138,7 +138,7 @@
       // TBR if (0 != val) return val;
       synchro::lock(*mutex);
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
 
       try
       {
@@ -151,7 +151,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -159,17 +159,17 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
 
       SLEEP(cm_lock_sleep_time());
       waitTime += cm_lock_sleep_time();
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
-   return 0;
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -179,10 +179,10 @@
 {
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
-      transaction::must_be_in_tm_conflicting_lock_set(mutex);
+      latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       synchro::lock(*latm_lock());
-      latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+      latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
       return synchro::try_lock(*mutex)?0:1;
    }
@@ -191,7 +191,7 @@
    //if (0 != val) return val;
    if (!synchro::try_lock(*mutex)) return 1;
 
-   synchro::lock(latmMutex_);
+   synchro::lock(latm::instance().latmMutex_);
 
    try
    {
@@ -201,19 +201,19 @@
       if (!dir_do_core_tm_conflicting_lock_pthread_lock_mutex(mutex, 0, 0))
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          return -1;
       }
    }
    catch (...)
    {
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
    return 0;
@@ -222,9 +222,9 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
-   synchro::lock(latmMutex_);
+   synchro::lock(latm::instance().latmMutex_);
    bool hasLock = true;
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
@@ -246,11 +246,11 @@
    // it from the latmLocks and check to see if we allow transactions to
    // continue.
    //--------------------------------------------------------------------------
-   if (tmConflictingLocks_.find(mutex) != tmConflictingLocks_.end())
+   if (latm::instance().tmConflictingLocks_.find(mutex) != latm::instance().tmConflictingLocks_.end())
    {
-      latmLockedLocks_.erase(mutex);
+      latm::instance().latmLockedLocks_.erase(mutex);
 
-      if (latmLockedLocks_.empty())
+      if (latm::instance().latmLockedLocks_.empty())
       {
          synchro::lock(*general_lock());
 
@@ -260,13 +260,13 @@
       }
    }
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
+   synchro::unlock(latm::instance().latmMutex_);
 
    //if (hasLock) return unlock(mutex);
    //else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 
 }}
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -95,9 +95,9 @@
 
       try
       {
-         latmLockedLocksAndThreadIdsMap_.insert
+         latm::instance().latmLockedLocksAndThreadIdsMap_.insert
          (std::make_pair<latm::mutex_type*, ThreadIdSet>(mutex, txThreadId));
-         latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+         latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       }
       catch (...)
       {
@@ -154,7 +154,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
 {
    int waitTime = 0, aborted = 0;
 
@@ -192,12 +192,12 @@
       t->add_to_currently_locked_locks(mutex);
       t->add_to_obtained_locks(mutex);
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
       def_do_core_tx_conflicting_lock_pthread_lock_mutex
          (mutex, 0, 0, true);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
 
-      return 0;
+      return;
    }
 
    for (;;)
@@ -206,7 +206,7 @@
       // TBR if (0 != val) return val;
       synchro::lock(*mutex);
 
-      synchro::lock(latmMutex_);
+      synchro::lock(latm::instance().latmMutex_);
 
       try
       {
@@ -219,7 +219,7 @@
       catch (...)
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          throw;
       }
 
@@ -227,19 +227,19 @@
       // we weren't able to do the core lock work, unlock our mutex and sleep
       //-----------------------------------------------------------------------
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
 
       SLEEP(cm_lock_sleep_time());
       waitTime += cm_lock_sleep_time();
       ++aborted;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
-   return 0;
+   return;
 }
 
 //----------------------------------------------------------------------------
@@ -256,7 +256,7 @@
    //if (0 != val) return val;
    if (!synchro::try_lock(*mutex)) return 1;
 
-   synchro::lock(latmMutex_);
+   synchro::lock(latm::instance().latmMutex_);
 
    if (transaction* t = get_inflight_tx_of_same_thread(false))
    {
@@ -274,19 +274,19 @@
       if (!dir_do_core_tx_conflicting_lock_pthread_lock_mutex(mutex, 0, 0, txIsIrrevocable))
       {
          synchro::unlock(*mutex);
-         synchro::unlock(latmMutex_);
+         synchro::unlock(latm::instance().latmMutex_);
          return -1;
       }
    }
    catch (...)
    {
       synchro::unlock(*mutex);
-      synchro::unlock(latmMutex_);
+      synchro::unlock(latm::instance().latmMutex_);
       throw;
    }
 
-   latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
-   synchro::unlock(latmMutex_);
+   latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+   synchro::unlock(latm::instance().latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
    // new transactions from starting until this lock is released
@@ -296,7 +296,7 @@
 //----------------------------------------------------------------------------
 // only allow one thread to execute any of these methods at a time
 //----------------------------------------------------------------------------
-inline int transaction::dir_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
+inline void transaction::dir_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
 {
    synchro::lock_guard<Mutex> autolock_l(*latm_lock());
    synchro::lock_guard<Mutex> autolock_g(*general_lock());
@@ -322,19 +322,19 @@
    // it from the latmLocks and any txs on the full thread list that are
    // blocked because of this lock being locked should be unblocked
    //--------------------------------------------------------------------------
-   if (latmLockedLocksAndThreadIdsMap_.find(mutex) != latmLockedLocksAndThreadIdsMap_.end())
+   if (latm::instance().latmLockedLocksAndThreadIdsMap_.find(mutex) != latm::instance().latmLockedLocksAndThreadIdsMap_.end())
    {
-      latmLockedLocksAndThreadIdsMap_.erase(mutex);
+      latm::instance().latmLockedLocksAndThreadIdsMap_.erase(mutex);
       unblock_conflicting_threads(mutex);
    }
 
-   latmLockedLocksOfThreadMap_.erase(mutex);
+   latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
    unblock_threads_if_locks_are_empty();
 
    // TBR if (hasLock) return unlock(mutex);
    // TBR else return 0;
    if (hasLock) synchro::unlock(*mutex);
-   return 0;
+   return;
 }
 }}
 
Modified: sandbox/stm/branches/vbe/boost/stm/detail/latm_general_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/latm_general_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/latm_general_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -51,7 +51,7 @@
    while (true)
    {
       synchro::lock(*latm_lock());
-      if (latmLockedLocks_.empty()) break;
+      if (latm::instance().latmLockedLocks_.empty()) break;
       synchro::unlock(*latm_lock());
       SLEEP(10);
    }
@@ -166,7 +166,7 @@
 inline void boost::stm::transaction::unblock_conflicting_threads(latm::mutex_type* mutex)
 {
    // if the mutex is on the latm locks map, we can't unblock yet
-   if (latmLockedLocksAndThreadIdsMap_.find(mutex) != latmLockedLocksAndThreadIdsMap_.end())
+   if (latm::instance().latmLockedLocksAndThreadIdsMap_.find(mutex) != latm::instance().latmLockedLocksAndThreadIdsMap_.end())
    {
 #if LOGGING_BLOCKS
       logFile_ << "\ncannot unlock <" << mutex << ">, in latmLockedLocksAndThreadIdsMap_" << endl << endl;
@@ -192,7 +192,7 @@
 {
 #if 0
    // if the size is 0, unblock everybody
-   if (latmLockedLocksOfThreadMap_.empty())
+   if (latm::instance().latmLockedLocksOfThreadMap_.empty())
    {
       for (latm::thread_id_mutex_set_map::iterator it = threadObtainedLocks_.begin();
       it != threadObtainedLocks_.end(); ++it)
@@ -206,8 +206,12 @@
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
+
 inline void boost::stm::transaction::tm_lock_conflict(latm::mutex_type* inLock)
 {
+#if 1
+    latm::instance().tm_lock_conflict(inLock);
+#else    
    if (!latm::instance().doing_tm_lock_protection()) return;
 
    //synchro::lock(latmMutex_);
@@ -225,8 +229,11 @@
       //throw;
    //}
    //synchro::unlock(latmMutex_);
+#endif   
 }
 
+#if 0
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 inline void boost::stm::transaction::clear_tm_conflicting_locks()
@@ -246,6 +253,7 @@
       throw "lock not in tx conflict lock set, use add_tm_conflicting_lock";
    }
 }
+#endif
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
@@ -300,21 +308,21 @@
 // the client chose
 //
 //----------------------------------------------------------------------------
-inline int boost::stm::transaction::pthread_lock(latm::mutex_type* mutex)
+inline void boost::stm::transaction::pthread_lock(latm::mutex_type* mutex)
 {
    //using namespace boost::stm;
 
    switch (latm::instance().protection())
    {
    case eFullLatmProtection:
-      if (direct_updating()) return dir_full_pthread_lock_mutex(mutex);
-      else return def_full_pthread_lock_mutex(mutex);
+      if (direct_updating())  {dir_full_pthread_lock_mutex(mutex); return;}
+      else {def_full_pthread_lock_mutex(mutex);return;}
    case eTmConflictingLockLatmProtection:
-      if (direct_updating()) return dir_tm_conflicting_lock_pthread_lock_mutex(mutex);
-      else return def_tm_conflicting_lock_pthread_lock_mutex(mutex);
+      if (direct_updating()) {dir_tm_conflicting_lock_pthread_lock_mutex(mutex);return;}
+      else {def_tm_conflicting_lock_pthread_lock_mutex(mutex);return;}
    case eTxConflictingLockLatmProtection:
-      if (direct_updating()) return dir_tx_conflicting_lock_pthread_lock_mutex(mutex);
-      else return def_tx_conflicting_lock_pthread_lock_mutex(mutex);
+      if (direct_updating()) {dir_tx_conflicting_lock_pthread_lock_mutex(mutex);return;}
+      else {def_tx_conflicting_lock_pthread_lock_mutex(mutex);return;}
    default:
       throw "invalid LATM type";
    }
@@ -322,6 +330,7 @@
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
+#if 0
 inline int boost::stm::transaction::pthread_trylock(latm::mutex_type* mutex)
 {
    //using namespace boost::stm;
@@ -341,24 +350,24 @@
       throw "invalid LATM type";
    }
 }
-
+#endif
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
-inline int boost::stm::transaction::pthread_unlock(latm::mutex_type* mutex)
+inline void boost::stm::transaction::pthread_unlock(latm::mutex_type* mutex)
 {
    //using namespace boost::stm;
 
    switch (latm::instance().protection())
    {
    case eFullLatmProtection:
-      if (direct_updating()) return dir_full_pthread_unlock_mutex(mutex);
-      return def_full_pthread_unlock_mutex(mutex);
+      if (direct_updating())  {dir_full_pthread_unlock_mutex(mutex);return;}
+      else {def_full_pthread_unlock_mutex(mutex);return;}
    case eTmConflictingLockLatmProtection:
-      if (direct_updating()) return dir_tm_conflicting_lock_pthread_unlock_mutex(mutex);
-      else return def_tm_conflicting_lock_pthread_unlock_mutex(mutex);
+      if (direct_updating()) {dir_tm_conflicting_lock_pthread_unlock_mutex(mutex);return;}
+      else {def_tm_conflicting_lock_pthread_unlock_mutex(mutex); return;}
    case eTxConflictingLockLatmProtection:
-      if (direct_updating()) return dir_tx_conflicting_lock_pthread_unlock_mutex(mutex);
-      else return def_tx_conflicting_lock_pthread_unlock_mutex(mutex);
+      if (direct_updating()) {dir_tx_conflicting_lock_pthread_unlock_mutex(mutex);return;}
+      else {def_tx_conflicting_lock_pthread_unlock_mutex(mutex);return;}
    default:
       throw "invalid LATM type";
    }
@@ -385,8 +394,8 @@
    //--------------------------------------------------------------------------
    // iterate through all currently locked locks
    //--------------------------------------------------------------------------
-   for (latm::mutex_thread_id_set_map::iterator iter = latmLockedLocksAndThreadIdsMap_.begin();
-   latmLockedLocksAndThreadIdsMap_.end() != iter; ++iter)
+   for (latm::mutex_thread_id_set_map::iterator iter = latm::instance().latmLockedLocksAndThreadIdsMap_.begin();
+   latm::instance().latmLockedLocksAndThreadIdsMap_.end() != iter; ++iter)
    {
       //-----------------------------------------------------------------------
       // iterate through this transaction's conflicting mutex ref - if one of
@@ -404,19 +413,19 @@
    for (latm::mutex_set::iterator k = get_tx_conflicting_locks().begin(); k != get_tx_conflicting_locks().end(); ++k)
    {
       // if it is locked by our thread, it is ok ... otherwise it is not
-      latm::mutex_thread_id_map::iterator l = latmLockedLocksOfThreadMap_.find(*k);
+      latm::mutex_thread_id_map::iterator l = latm::instance().latmLockedLocksOfThreadMap_.find(*k);
 
-      if (l != latmLockedLocksOfThreadMap_.end() &&
+      if (l != latm::instance().latmLockedLocksOfThreadMap_.end() &&
          this_thread::get_id() != l->second)
       {
-         latm::mutex_thread_id_set_map::iterator locksAndThreadsIter = latmLockedLocksAndThreadIdsMap_.find(*k);
+         latm::mutex_thread_id_set_map::iterator locksAndThreadsIter = latm::instance().latmLockedLocksAndThreadIdsMap_.find(*k);
 
-         if (locksAndThreadsIter == latmLockedLocksAndThreadIdsMap_.end())
+         if (locksAndThreadsIter == latm::instance().latmLockedLocksAndThreadIdsMap_.end())
          {
             ThreadIdSet s;
             s.insert(this_thread::get_id());
 
-            latmLockedLocksAndThreadIdsMap_.insert
+            latm::instance().latmLockedLocksAndThreadIdsMap_.insert
             (std::make_pair<latm::mutex_type*, ThreadIdSet>(*k, s));
          }
          else
@@ -440,8 +449,8 @@
 {
    int count = 0;
 
-   for (latm::mutex_thread_id_set_map::iterator iter = latmLockedLocksAndThreadIdsMap_.begin();
-      latmLockedLocksAndThreadIdsMap_.end() != iter; ++iter)
+   for (latm::mutex_thread_id_set_map::iterator iter = latm::instance().latmLockedLocksAndThreadIdsMap_.begin();
+      latm::instance().latmLockedLocksAndThreadIdsMap_.end() != iter; ++iter)
    {
       if (iter->second.find(threadId) != iter->second.end()) ++count;
    }
Modified: sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -539,8 +539,8 @@
 
    o << "Currently locked locks:" << endl << endl;
 
-   for (latm::mutex_thread_id_set_map::iterator i = latmLockedLocksAndThreadIdsMap_.begin();
-   i != latmLockedLocksAndThreadIdsMap_.end(); ++i)
+   for (latm::mutex_thread_id_set_map::iterator i = latm::instance().latmLockedLocksAndThreadIdsMap_.begin();
+   i != latm::instance().latmLockedLocksAndThreadIdsMap_.end(); ++i)
    {
       o << i->first << endl << "\t";
 
@@ -616,6 +616,7 @@
    return true;
 }
 
+#if 0
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
 inline bool transaction::can_go_inflight()
@@ -658,7 +659,7 @@
 
    return true;
 }
-
+#endif
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
 inline void transaction::put_tx_inflight()
@@ -670,7 +671,7 @@
       //lock(inflight_lock());
       synchro::lock_guard<Mutex> lock_i(*inflight_lock());
 
-      if (can_go_inflight() && !isolatedTxInFlight())
+      if (latm::instance().can_go_inflight() && !isolatedTxInFlight())
       {
          transactionsInFlight_.insert(this);
          state_ = e_in_flight;
Modified: sandbox/stm/branches/vbe/boost/stm/latm/base_mode.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/base_mode.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/base_mode.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -1,10 +1,10 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (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/stm for documentation.
@@ -16,23 +16,39 @@
 
 #include <boost/stm/detail/config.hpp>
 #include <boost/stm/latm/datatypes.hpp>
+#include <boost/synchro.hpp>
 
 namespace boost { namespace stm { namespace latm {
 
-    class base_mode {
-    public:
-        virtual latm_type const protection() =0;
-        virtual std::string const protection_str();
-
-        virtual bool doing_full_lock_protection();
-        virtual bool doing_tm_lock_protection();
-        virtual bool doing_tx_lock_protection();
-        
-        virtual void lock(mutex_type& lock);
-        virtual bool try_lock(mutex_type& lock);
-        virtual void unlock(mutex_type& lock);
-    };
-    
+template <typename Base=static_mode>
+class base_mode : public Base {
+public:
+    latm::mutex_set tmConflictingLocks_;
+    latm::mutex_set latmLockedLocks_;
+    latm::mutex_thread_id_set_map latmLockedLocksAndThreadIdsMap_;
+    latm::mutex_thread_id_map latmLockedLocksOfThreadMap_;
+
+    mutex_type latmMutex_;
+
+
+    latm::mutex_set get_tm_conflicting_locks() { return tmConflictingLocks_; }
+
+    void clear_tm_conflicting_locks()
+    {
+        synchro::lock_guard<Mutex> lock_l(latmMutex_);
+        tmConflictingLocks_.clear();
+    }
+
+    void must_be_in_tm_conflicting_lock_set(latm::mutex_type* inLock)
+    {
+       if (tmConflictingLocks_.find(inLock) == tmConflictingLocks_.end())
+       {
+          throw "lock not in tx conflict lock set, use add_tm_conflicting_lock";
+       }
+    }
+
+};
+
 }}}
 
 #endif // BOOST_STM_LATM_DYNAMIC__HPP
Modified: sandbox/stm/branches/vbe/boost/stm/latm/datatypes.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/datatypes.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/datatypes.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -20,6 +20,7 @@
 #include <map>
 
 namespace boost { namespace stm { namespace latm {
+    struct static_mode {};
 #if BOOST_STM_LATM_GENERIC    
    //typedef synchro::poly::mutex mutex_type;
 #else    
Deleted: sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
+++ (empty file)
@@ -1,112 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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_LATM_DYNAMIC__HPP
-#define BOOST_STM_LATM_DYNAMIC__HPP
-
-#include <boost/stm/detail/config.hpp>
-#include <boost/stm/latm/datatypes.hpp>
-
-namespace boost { namespace stm { namespace latm {
-    #if 0
-    struct poly {
-        static full_mode<base_mode> full_;
-        static tm_mode<base_mode> tm_;
-        static tx_mode<base_mode> tx_;
-        static base_mode* more_;      
-    };
-    void do_full_lock_protection() {
-        poly::mode_ = &full_;
-    }
-    void do_tm_lock_protection() {
-        poly::mode_ = &tm_;
-    }
-    void do_tx_lock_protection() {
-        poly::mode_ = &tx_;
-    }
-    inline base_mode& instance() {
-        return poly::mode_;
-    }
-    
-    #endif
-    class dynamic {
-        latm_type eLatmType_;
-    public:
-        dynamic() : eLatmType_(eFullLatmProtection) {}
-        latm_type const protection() { return eLatmType_; }
-        std::string const protection_str() {
-           switch (eLatmType_)
-           {
-           case eFullLatmProtection:
-              return "full_protect";
-           case eTmConflictingLockLatmProtection:
-              return "tm_protect";
-           case eTxConflictingLockLatmProtection:
-              return "tx_protect";
-           default:
-              throw "invalid LATM type";
-           }
-        }
-        void do_full_lock_protection_i() {
-            eLatmType_ = eFullLatmProtection;
-        }
-        void do_tm_lock_protection_i() {
-            eLatmType_ = eTmConflictingLockLatmProtection;
-        }
-        void do_tx_lock_protection_i() {
-            eLatmType_ = eTxConflictingLockLatmProtection;
-        }
-
-        bool doing_full_lock_protection() {
-            return eFullLatmProtection == eLatmType_;
-        }
-        bool doing_tm_lock_protection() {
-            return eTmConflictingLockLatmProtection == eLatmType_;
-        }
-        bool doing_tx_lock_protection() {
-            return eTxConflictingLockLatmProtection == eLatmType_;
-        }
-        
-#if BOOST_STM_LATM_GENERIC    
-       template <typename Lockable>
-       void lock(Lockable& lock);
-       template <typename Lockable>
-       bool try_lock(Lockable& lock);
-       template <typename Lockable>
-       void unlock(Lockable& lock);
-#else    
-       int lock(mutex_type& lock);
-       int try_lock(mutex_type& lock);
-       int unlock(mutex_type& lock);
-#endif    
-        
-    };
-    inline dynamic& instance() {
-        static dynamic ctx;
-        return ctx;
-    }
-    inline void do_full_lock_protection() {
-        instance().do_full_lock_protection_i();
-    }
-    inline void do_tm_lock_protection() {
-        instance().do_tm_lock_protection_i();
-    }
-    inline void do_tx_lock_protection() {
-        instance().do_tx_lock_protection_i();
-    }
-    
-}}}
-
-#endif // BOOST_STM_LATM_DYNAMIC__HPP
-
-
Copied: sandbox/stm/branches/vbe/boost/stm/latm/dynamic_mode.hpp (from r57154, /sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp)
==============================================================================
--- /sandbox/stm/branches/vbe/boost/stm/latm/dynamic.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/dynamic_mode.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -16,94 +16,33 @@
 
 #include <boost/stm/detail/config.hpp>
 #include <boost/stm/latm/datatypes.hpp>
+#include <boost/stm/latm/base_mode.hpp>
+#include <boost/stm/latm/abstract_mode.hpp>
+#include <boost/stm/latm/full_mode.hpp>
+#include <boost/stm/latm/tm_mode.hpp>
+#include <boost/stm/latm/tx_mode.hpp>
 
 namespace boost { namespace stm { namespace latm {
-    #if 0
-    struct poly {
-        static full_mode<base_mode> full_;
-        static tm_mode<base_mode> tm_;
-        static tx_mode<base_mode> tx_;
-        static base_mode* more_;      
+    typedef base_mode<abstract_mode> latm_mode;
+    struct mode {
+        static full_mode<abstract_mode> full_;
+        static tm_mode<abstract_mode> tm_;
+        static tx_mode<abstract_mode> tx_;
+        static latm_mode* instance_;      
     };
-    void do_full_lock_protection() {
-        poly::mode_ = &full_;
-    }
-    void do_tm_lock_protection() {
-        poly::mode_ = &tm_;
-    }
-    void do_tx_lock_protection() {
-        poly::mode_ = &tx_;
-    }
-    inline base_mode& instance() {
-        return poly::mode_;
-    }
-    
-    #endif
-    class dynamic {
-        latm_type eLatmType_;
-    public:
-        dynamic() : eLatmType_(eFullLatmProtection) {}
-        latm_type const protection() { return eLatmType_; }
-        std::string const protection_str() {
-           switch (eLatmType_)
-           {
-           case eFullLatmProtection:
-              return "full_protect";
-           case eTmConflictingLockLatmProtection:
-              return "tm_protect";
-           case eTxConflictingLockLatmProtection:
-              return "tx_protect";
-           default:
-              throw "invalid LATM type";
-           }
-        }
-        void do_full_lock_protection_i() {
-            eLatmType_ = eFullLatmProtection;
-        }
-        void do_tm_lock_protection_i() {
-            eLatmType_ = eTmConflictingLockLatmProtection;
-        }
-        void do_tx_lock_protection_i() {
-            eLatmType_ = eTxConflictingLockLatmProtection;
-        }
-
-        bool doing_full_lock_protection() {
-            return eFullLatmProtection == eLatmType_;
-        }
-        bool doing_tm_lock_protection() {
-            return eTmConflictingLockLatmProtection == eLatmType_;
-        }
-        bool doing_tx_lock_protection() {
-            return eTxConflictingLockLatmProtection == eLatmType_;
-        }
-        
-#if BOOST_STM_LATM_GENERIC    
-       template <typename Lockable>
-       void lock(Lockable& lock);
-       template <typename Lockable>
-       bool try_lock(Lockable& lock);
-       template <typename Lockable>
-       void unlock(Lockable& lock);
-#else    
-       int lock(mutex_type& lock);
-       int try_lock(mutex_type& lock);
-       int unlock(mutex_type& lock);
-#endif    
-        
-    };
-    inline dynamic& instance() {
-        static dynamic ctx;
-        return ctx;
-    }
     inline void do_full_lock_protection() {
-        instance().do_full_lock_protection_i();
+        mode::instance_ = &mode::full_;
     }
     inline void do_tm_lock_protection() {
-        instance().do_tm_lock_protection_i();
+        mode::instance_ = &mode::tm_;
     }
     inline void do_tx_lock_protection() {
-        instance().do_tx_lock_protection_i();
+        mode::instance_ = &mode::tx_;
     }
+    inline latm_mode& instance() {
+        return *mode::instance_;
+    }
+    
     
 }}}
 
Deleted: sandbox/stm/branches/vbe/boost/stm/latm/full.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/full.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
+++ (empty file)
@@ -1,51 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (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_LATM_DYNAMIC__HPP
-#define BOOST_STM_LATM_DYNAMIC__HPP
-
-#include <boost/stm/detail/config.hpp>
-#include <boost/stm/latm/datatypes.hpp>
-
-namespace boost { namespace stm { namespace latm {
-
-    struct static_mode {};
-    template <typename Base=static_mode>
-    class full_mode : {
-    public:
-        latm_type const protection() { return eFullLatmProtection; }
-        std::string const protection_str() {
-            return "full_protect";
-        }
-
-        bool doing_full_lock_protection() {
-            return true;
-        }
-        bool doing_tm_lock_protection() {
-            return false;
-        }
-        bool doing_tx_lock_protection() {
-            return false;
-        }
-        
-        int lock(mutex_type& lock);
-        int try_lock(mutex_type& lock);
-        int unlock(mutex_type& lock);
-        
-    };
-    
-}}}
-
-#endif // BOOST_STM_LATM_DYNAMIC__HPP
-
-
Copied: sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp (from r57154, /sandbox/stm/branches/vbe/boost/stm/latm/full.hpp)
==============================================================================
--- /sandbox/stm/branches/vbe/boost/stm/latm/full.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -1,51 +1,89 @@
 //////////////////////////////////////////////////////////////////////////////
 //
-// (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/stm for documentation.
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_STM_LATM_DYNAMIC__HPP
-#define BOOST_STM_LATM_DYNAMIC__HPP
+#ifndef BOOST_STM_LATM_FULL_MIXIN__HPP
+#define BOOST_STM_LATM_FULL_MIXIN__HPP
 
+//-----------------------------------------------------------------------------
 #include <boost/stm/detail/config.hpp>
 #include <boost/stm/latm/datatypes.hpp>
+#include <boost/stm/latm/base_mode.hpp>
+//-----------------------------------------------------------------------------
 
+//-----------------------------------------------------------------------------
 namespace boost { namespace stm { namespace latm {
 
-    struct static_mode {};
-    template <typename Base=static_mode>
-    class full_mode : {
-    public:
-        latm_type const protection() { return eFullLatmProtection; }
-        std::string const protection_str() {
-            return "full_protect";
+//-----------------------------------------------------------------------------
+template <typename Base=static_mode>
+class full_mode : public base_mode<Base> {
+public:
+
+    ~full_mode() {}
+//-----------------------------------------------------------------------------
+    latm_type const protection() { return eFullLatmProtection; }
+    std::string const protection_str() {
+        return "full_protect";
+    }
+
+    bool doing_full_lock_protection() {
+        return true;
+    }
+
+    bool doing_tm_lock_protection() {
+        return false;
+    }
+
+    bool doing_tx_lock_protection() {
+        return false;
+    }
+
+//-----------------------------------------------------------------------------
+    bool can_go_inflight()
+    {
+        // allow transactions
+        // to start only if no locks are obtained or the only lock that
+        // is obtained is on this_thread::get_id()
+        for (latm::mutex_thread_id_map::iterator j = this->latmLockedLocksOfThreadMap_.begin();
+        j != this->latmLockedLocksOfThreadMap_.end(); ++j)
+        {
+            if (this_thread::get_id() != j->second)
+            {
+                return false;
+            }
         }
 
-        bool doing_full_lock_protection() {
-            return true;
-        }
-        bool doing_tm_lock_protection() {
-            return false;
-        }
-        bool doing_tx_lock_protection() {
-            return false;
-        }
-        
-        int lock(mutex_type& lock);
-        int try_lock(mutex_type& lock);
-        int unlock(mutex_type& lock);
-        
+        return true;
+    }
+
+//-----------------------------------------------------------------------------
+    void tm_lock_conflict(Mutex &lock)
+    {
+        tm_lock_conflict(&lock);
+    }
+    void tm_lock_conflict(latm::mutex_type* inLock)
+    {
+        return ;
+    }
+
+//-----------------------------------------------------------------------------
+        //int lock(mutex_type& lock);
+        //int try_lock(mutex_type& lock);
+        //int unlock(mutex_type& lock);
+
     };
-    
+
 }}}
 
-#endif // BOOST_STM_LATM_DYNAMIC__HPP
+#endif // BOOST_STM_LATM_FULL_MIXIN__HPP
 
 
Modified: sandbox/stm/branches/vbe/boost/stm/latm/selector.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/selector.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/selector.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -18,10 +18,16 @@
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
 
-#if defined(BOOST_STM_LATM_STATIC_CONF)
-#include BOOST_STM_LATM_STATIC_CONF
+#if defined(BOOST_STM_LATM_STATIC_FULL_MODE)
+#include <boost/stm/latm/static_full_mode.hpp>
+#elif defined(BOOST_STM_LATM_STATIC_TM_MODE)
+#include <boost/stm/latm/static_tm_mode.hpp>
+#elif defined(BOOST_STM_LATM_STATIC_TX_MODE)
+#include <boost/stm/latm/static_tx_mode.hpp>
+#elif defined(BOOST_STM_LATM_DYNAMIC_MODE)
+#include <boost/stm/latm/dynamic_mode.hpp>
 #else
-#include <boost/stm/latm/dynamic.hpp>
+#include <boost/stm/latm/all_in_one_mode.hpp>
 #endif
 
 #endif // BOOST_STM_LATM_SELECTOR__HPP
Modified: sandbox/stm/branches/vbe/boost/stm/transaction.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction.hpp	(original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction.hpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -334,19 +334,19 @@
    template <>
    inline static int unlock_(Mutex *lock) { return pthread_unlock(lock); }
     #else
-   inline static int lock_(PLOCK &lock) { return pthread_lock(&lock); }
-   inline static int lock_(PLOCK *lock) { return pthread_lock(lock); }
+   inline static void lock_(latm::mutex_type &lock) { pthread_lock(&lock); }
+   inline static void lock_(latm::mutex_type *lock) { pthread_lock(lock); }
 
-   inline static int trylock_(PLOCK &lock) { return pthread_trylock(&lock); }
-   inline static int trylock_(PLOCK *lock) { return pthread_trylock(lock); }
+   //inline static int trylock_(latm::mutex_type &lock) { return pthread_trylock(&lock); }
+   //inline static int trylock_(latm::mutex_type *lock) { return pthread_trylock(lock); }
 
-   inline static int unlock_(PLOCK &lock) { return pthread_unlock(&lock); }
-   inline static int unlock_(PLOCK *lock) { return pthread_unlock(lock); }
+   inline static void unlock_(latm::mutex_type &lock) { pthread_unlock(&lock); }
+   inline static void unlock_(latm::mutex_type *lock) { pthread_unlock(lock); }
     #endif
 
-   static int pthread_lock(latm::mutex_type* lock);
-   static int pthread_trylock(latm::mutex_type* lock);
-   static int pthread_unlock(latm::mutex_type* lock);
+   static void pthread_lock(latm::mutex_type* lock);
+   //static int pthread_trylock(latm::mutex_type* lock);
+   static void pthread_unlock(latm::mutex_type* lock);
 
    //--------------------------------------------------------------------------
     #if PERFORMING_LATM
@@ -356,12 +356,12 @@
       tm_lock_conflict(&lock);
    }
    static void tm_lock_conflict(latm::mutex_type* lock);
-
+   
    static void clear_tm_conflicting_locks();
-   inline static latm::mutex_set get_tm_conflicting_locks() { return tmConflictingLocks_; }
+   //inline static latm::mutex_set get_tm_conflicting_locks() { return tmConflictingLocks_; }
 
    void must_be_in_conflicting_lock_set(latm::mutex_type* inLock);
-   static void must_be_in_tm_conflicting_lock_set(latm::mutex_type* inLock);
+   //static void must_be_in_tm_conflicting_lock_set(latm::mutex_type* inLock);
 
     #if USING_TRANSACTION_SPECIFIC_LATM
    void see_if_tx_must_block_due_to_tx_latm();
@@ -380,6 +380,8 @@
 
    void clear_tx_conflicting_locks();
    //latm::mutex_set get_tx_conflicting_locks() { return conflictingMutexRef_; }
+   
+  
     #endif
 
    void add_to_obtained_locks(latm::mutex_type* mutex);
@@ -743,7 +745,8 @@
    void lock_tx();
    void unlock_tx();
 
-   inline static PLOCK* latm_lock() { return &latmMutex_; }
+   //inline static latm_mutex* latm_lock() { return &latmMutex_; }
+   inline static latm::mutex_type* latm_lock() { return &latm::instance().latmMutex_; }
    inline static PLOCK* general_lock() { return &transactionMutex_; }
    inline static PLOCK* inflight_lock() { return &transactionsInFlightMutex_; }
 
@@ -754,7 +757,7 @@
    bool canAbortAllInFlightTxs();
    bool abortAllInFlightTxs();
    void put_tx_inflight();
-   bool can_go_inflight();
+   //static bool can_go_inflight();
    static transaction* get_inflight_tx_of_same_thread(bool);
 
 #if !PERFORMING_VALIDATION
@@ -1276,32 +1279,32 @@
    //--------------------------------------------------------------------------
    // deferred updating locking methods
    //--------------------------------------------------------------------------
-   static int def_full_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void def_full_pthread_lock_mutex(latm::mutex_type* mutex);
    static int def_full_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int def_full_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void def_full_pthread_unlock_mutex(latm::mutex_type* mutex);
 
-   static int def_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void def_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
    static int def_tm_conflicting_lock_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int def_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void def_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
 
-   static int def_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void def_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
    static int def_tx_conflicting_lock_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int def_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void def_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
 
    //--------------------------------------------------------------------------
    // direct updating locking methods
    //--------------------------------------------------------------------------
-   static int dir_full_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void dir_full_pthread_lock_mutex(latm::mutex_type* mutex);
    static int dir_full_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int dir_full_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void dir_full_pthread_unlock_mutex(latm::mutex_type* mutex);
 
-   static int dir_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void dir_tm_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
    static int dir_tm_conflicting_lock_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int dir_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void dir_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
 
-   static int dir_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
+   static void dir_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex);
    static int dir_tx_conflicting_lock_pthread_trylock_mutex(latm::mutex_type* mutex);
-   static int dir_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
+   static void dir_tx_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex);
 
    //--------------------------------------------------------------------------
 
@@ -1309,18 +1312,18 @@
    static DeletionBuffer deletionBuffer_;
    static std::ofstream logFile_;
 
-   static latm::mutex_set tmConflictingLocks_;
-   static latm::mutex_set latmLockedLocks_;
-   static latm::mutex_thread_id_set_map latmLockedLocksAndThreadIdsMap_;
-   static latm::mutex_thread_id_map latmLockedLocksOfThreadMap_;
+   //static latm::mutex_set tmConflictingLocks_;
+   //static latm::mutex_set latmLockedLocks_;
+   //static latm::mutex_thread_id_set_map latmLockedLocksAndThreadIdsMap_;
+   //static latm::mutex_thread_id_map latmLockedLocksOfThreadMap_;
    //static LatmType eLatmType_;
    static InflightTxes transactionsInFlight_;
 
    static Mutex deletionBufferMutex_;
    static Mutex transactionMutex_;
    static Mutex transactionsInFlightMutex_;
-   static Mutex latmMutex_;
-   static pthread_mutexattr_t transactionMutexAttribute_;
+   //static Mutex latmMutex_;
+   //static pthread_mutexattr_t transactionMutexAttribute_;
 
    static bool initialized_;
    static bool directLateWriteReadConflict_;
@@ -2015,27 +2018,6 @@
     ~thread_initializer() {transaction::terminate_thread();}
 };
 
-#if 0
-
-template <>
-inline int transaction::lock<Mutex> (Mutex &lock) { return transaction::pthread_lock(&lock); }
-
-template <>
-inline int transaction::lock<Mutex*> (Mutex *lock) { return transaction::pthread_lock(lock); }
-
-template <>
-inline int transaction::trylock<Mutex> (Mutex &lock) { return transaction::pthread_trylock(&lock); }
-
-template <>
-inline int transaction::trylock<Mutex*> (Mutex *lock) { return transaction::pthread_trylock(lock); }
-
-template <>
-inline int transaction::unlock<Mutex> (Mutex &lock) { return transaction::pthread_unlock(&lock); }
-
-template <>
-inline int transaction::unlock<Mutex*> (Mutex *lock) { return transaction::pthread_unlock(lock); }
-
-#endif
 
 //---------------------------------------------------------------------------
 // do not remove if (). It is necessary a necessary fix for compilers
Modified: sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -12,6 +12,7 @@
 //////////////////////////////////////////////////////////////////////////////
 
 #include <boost/stm/transaction.hpp>
+#include <boost/stm/latm.hpp>
 #include <boost/stm/non_tx/detail/cache_map.hpp>
 #include <boost/stm/contention_managers/contention_manager.hpp>
 #include <iostream>
@@ -31,12 +32,33 @@
 // Static initialization
 ///////////////////////////////////////////////////////////////////////////////
 transaction::InflightTxes transaction::transactionsInFlight_;
-latm::mutex_set transaction::latmLockedLocks_;
-latm::mutex_thread_id_set_map transaction::latmLockedLocksAndThreadIdsMap_;
-latm::mutex_thread_id_map transaction::latmLockedLocksOfThreadMap_;
-latm::mutex_set transaction::tmConflictingLocks_;
+//latm::mutex_set transaction::latmLockedLocks_;
+//latm::mutex_thread_id_set_map transaction::latmLockedLocksAndThreadIdsMap_;
+//latm::mutex_thread_id_map transaction::latmLockedLocksOfThreadMap_;
+//latm::mutex_set transaction::tmConflictingLocks_;
 transaction::DeletionBuffer transaction::deletionBuffer_;
 
+//////////////
+// LATM
+/////////////
+namespace latm {
+#if defined(BOOST_STM_LATM_STATIC_FULL_MODE)
+latm_mode mode::instance_;
+#elif defined(BOOST_STM_LATM_STATIC_TM_MODE)
+latm_mode mode::instance_;
+#elif defined(BOOST_STM_LATM_STATIC_TX_MODE)
+latm_mode mode::instance_;
+#elif defined(BOOST_STM_LATM_DYNAMIC_MODE)
+full_mode<abstract_mode> mode::full_;
+tm_mode<abstract_mode> mode::tm_;
+tx_mode<abstract_mode> mode::tx_;
+latm_mode* mode::instance_=&mode::full_;
+#else
+latm_mode mode::instance_;
+#endif
+}
+
+
 clock_t transaction::global_clock_ = 0;
 size_t transaction::stalls_ = 0;
 
@@ -45,12 +67,12 @@
 bool transaction::directLateWriteReadConflict_ = false;
 bool transaction::usingMoveSemantics_ = false;
 
-pthread_mutexattr_t transaction::transactionMutexAttribute_;
+//pthread_mutexattr_t transaction::transactionMutexAttribute_;
 
 Mutex transaction::transactionsInFlightMutex_;
 Mutex transaction::transactionMutex_;
 Mutex transaction::deletionBufferMutex_;
-Mutex transaction::latmMutex_;
+//Mutex transaction::latmMutex_;
 
 std::ofstream transaction::logFile_;
 
@@ -150,7 +172,7 @@
    pthread_mutex_init(&transactionMutex_, 0);
    pthread_mutex_init(&transactionsInFlightMutex_, 0);
    pthread_mutex_init(&deletionBufferMutex_, 0);
-   pthread_mutex_init(&latmMutex_, 0);
+   pthread_mutex_init(&latm::instance().latmMutex_, 0);
 
    //pthread_mutex_init(&transactionMutex_, &transactionMutexAttribute_);
    //pthread_mutex_init(&transactionsInFlightMutex_, &transactionMutexAttribute_);
Modified: sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -53,72 +53,147 @@
 
     alias def_invalid
         :
+            [ run stm : -bench accounts -def -threads 2 -inserts 100 : : : test_accounts_def_t2_i100 ]
+            ########### fails sometimes
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
             [ run stm : -bench accounts -def -threads 4 -inserts 100 : : : test_accounts_def_t4_i100 ]
 
-            [ run stm : -bench hashmap -def -threads 4 -inserts 100 : : : test_hashmap_def_t4_i100 ]
+            [ run stm : -bench hashmap -def -threads 2 -inserts 100 : : : test_hashmap_def_t2_i100 ]
+            ########### fails
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
+            #[ run stm : -bench hashmap -def -threads 4 -inserts 100 : : : test_hashmap_def_t4_i100 ]
 
 
             ########### fails
             # /bin/sh: line 4:  2944 Aborted                 (core dumped) "bin/test_ht_def_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_ht_def_t2_i1000.exe" > "bin/test_ht_def_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_ht_def_t2_i1000.output" 2>&1
             # Rounding max threads to the next multiple of 4 (4).
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench ht -def -threads 2 -inserts 100 : : : test_ht_def_t2_i100 ]
+            #[ run stm : -bench ht -def -threads 2 -inserts 100 -latm full : : : test_ht_def_full_t2_i100 ]
+            [ run stm : -bench ht -def -threads 2 -inserts 100 -latm tm : : : test_ht_def_tm_t2_i100 ]
+            [ run stm : -bench ht -def -threads 4 -inserts 100 -latm tm : : : test_ht_def_tm_t4_i100 ]
+            [ run stm : -bench ht -def -threads 2 -inserts 100 -latm tx : : : test_ht_def_tx_t2_i100 ]
+            [ run stm : -bench ht -def -threads 4 -inserts 100 -latm tx : : : test_ht_def_tx_t4_i100 ]
 
             [ run stm : -bench isolated_int -def -threads 4 -inserts 100 : : : test_isolated_int_def_t2_i100 ]
 
+            [ run stm : -bench linkedlist -def -threads 2 -inserts 100 : : : test_linkedlist_def_t2_i100 ]
+            ########### fails sometimes
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
             [ run stm : -bench linkedlist -def -threads 4 -inserts 100 : : : test_linkedlist_def_t4_i100 ]
 
             ########### fails
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench ll -def -threads 2 -inserts 100 : : : test_ll_def_t2_i100 ]
+            #[ run stm : -bench ll -def -threads 2 -inserts 100 -latm full : : : test_ll_def_full_t2_i100 ]
+            [ run stm : -bench ll -def -threads 2 -inserts 100 -latm tm : : : test_ll_def_tm_t2_i100 ]
+            [ run stm : -bench ll -def -threads 4 -inserts 100 -latm tm : : : test_ll_def_tm_t4_i100 ]
+            ########### fails
+            #[ run stm : -bench ll -def -threads 2 -inserts 100 -latm tx : : : test_ll_def_tx_t2_i100 ]
 
-            ########### deadlock. killed after 0:26. 00% CPU
+            ########### fails all-modes
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
             #   19469 [sig] test_tx_linear_lock_def_t2 3768 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)
-            [ run stm : -bench tx_linear_lock -def -threads 2 -inserts 100 : : : test_tx_linear_lock_def_t2_i100 ]
+            #[ run stm : -bench tx_linear_lock -def -threads 2 -inserts 100 -latm full : : : test_tx_linear_lock_def_full_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench tx_linear_lock -def -threads 2 -inserts 100 -latm tm : : : test_tx_linear_lock_def_tm_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench tx_linear_lock -def -threads 2 -inserts 100 -latm tx : : : test_tx_linear_lock_def_tx_t2_i100 ]
 
-            ########### deadlock. killed after 0:26. 00% CPU
-            [ run stm : -bench isolated_int_lock_in_tx -def -threads 2 -inserts 100 : : : test_isolated_int_lock_in_tx_def_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 2 -inserts 100 -latm full : : : test_isolated_int_lock_in_tx_def_full_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 4 -inserts 100 -latm full : : : test_isolated_int_lock_in_tx_def_full_t4_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 2 -inserts 100 -latm tm : : : test_isolated_int_lock_in_tx_def_tm_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 4 -inserts 100 -latm tm : : : test_isolated_int_lock_in_tx_def_tm_t4_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 2 -inserts 100 -latm tx : : : test_isolated_int_lock_in_tx_def_tx_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -def -threads 4 -inserts 100 -latm tx : : : test_isolated_int_lock_in_tx_def_tx_t4_i100 ]
 
-            ###########  fails
+            ###########  fails all-modes
             # /bin/sh: line 4:  3660 Segmentation fault      (core dumped) "bin/test_isolated_composed_int_lock_def_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock_def_t2.exe" > "bin/test_isolated_composed_int_lock_def_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock_def_t2.output" 2>&1
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench isolated_composed_int_lock -def -threads 2 -inserts 100 : : : test_isolated_composed_int_lock_def_t2_i100 ]
+            #[ run stm : -bench isolated_composed_int_lock -def -threads 2 -inserts 100 -latm full : : : test_isolated_composed_int_lock_def_full_t2_i100 ]
+            ########### fails
+            # /bin/sh: line 4:  4744 Aborted                 (core dumped) "bin/gcc-3.4.4/debug/threading-multi/stm.exe" -bench isolated_composed_int_lock -def -threads 2 -inserts 100 -latm tm > "bin/test_isolated_composed_int_lock_def_tm_t2_i100.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock_def_tm_t2_i100.output" 2>&1
+            #[ run stm : -bench isolated_composed_int_lock -def -threads 2 -inserts 100 -latm tm : : : test_isolated_composed_int_lock_def_tm_t2_i100 ]
+            ########### fails
+            # /bin/sh: line 4:  4772 Aborted                 (core dumped) "bin/gcc-3.4.4/debug/threading-multi/stm.exe" -bench isolated_composed_int_lock -def -threads 2 -inserts 100 -latm tx > "bin/test_isolated_composed_int_lock_def_tx_t2_i100.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock_def_tx_t2_i100.output" 2>&1
+            #[ run stm : -bench isolated_composed_int_lock -def -threads 2 -inserts 100 -latm tx : : : test_isolated_composed_int_lock_def_tx_t2_i100 ]
 
             ###########  fails
-            # /bin/sh: line 4:  3172 Aborted                 (core dumped) "bin/test_isolated_composed_int_lock2_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_dir_t2.exe" > "bin/test_isolated_composed_int_lock2_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_dir_t2.output" 2>&1
-            # ====== BEGIN OUTPUT ======
-            # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 : : : test_isolated_composed_int_lock2_def_t2_i100 ]
+            #/bin/sh: line 4:  4536 Aborted                 (core dumped) "bin/gcc-3.4.4/debug/threading-multi/stm.exe" -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 -latm full > "bin/test_isolated_composed_int_lock2_def_full_t2_i100.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_def_full_t2_i100.output" 2>&1
+            #====== BEGIN OUTPUT ======
+            #61 i= 0
+            #66 i=0 end= 50 count= 1
+            #70 lock
+            #73	1
+            #74 unlock
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
+            #[ run stm : -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 -latm full : : : test_isolated_composed_int_lock2_def_full_t2_i100 ]
+            ###########  fails
+            #/bin/sh: line 4:  4556 Aborted                 (core dumped) "bin/gcc-3.4.4/debug/threading-multi/stm.exe" -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 -latm tm > "bin/test_isolated_composed_int_lock2_def_tm_t2_i100.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_def_tm_t2_i100.output" 2>&1
+            #====== BEGIN OUTPUT ======
+            #61 i= 0
+            #66 i=0 end= 50 count= 1
+            #70 lock            
+            #[ run stm : -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 -latm tm : : : test_isolated_composed_int_lock2_def_tm_t2_i100 ]
+            [ run stm : -bench isolated_composed_int_lock2 -def -threads 2 -inserts 100 -latm tx : : : test_isolated_composed_int_lock2_def_tx_t2_i100 ]
+            ###########  fails
+            #[ run stm : -bench isolated_composed_int_lock2 -def -threads 4 -inserts 100 -latm tx : : : test_isolated_composed_int_lock2_def_tx_t4_i100 ]
 
+            [ run stm : -bench irrevocable_int -def -threads 2 -inserts 100 : : : test_irrevocable_int_def_t2_i100 ]
+            ###########  fails sometimes
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
             [ run stm : -bench irrevocable_int -def -threads 4 -inserts 100 : : : test_irrevocable_int_def_t4_i100 ]
 
-            ########### deadlock. killed after 0:26. 00% CPU
-            #[ run stm : -bench lot_example -def -threads 2 -inserts 100 : : : test_lot_example_def_t2_i100 ]
+            ########### deadlock. killed after 0:26. 00% CPU  all-modes
+            #[ run stm : -bench lot_example -def -threads 2 -inserts 100 -latm full : : : test_lot_example_def_full_t2_i100 ]
+            ########### deadlock. 
+            #[ run stm : -bench lot_example -def -threads 2 -inserts 100 -latm tm : : : test_lot_example_def_tm_t2_i100 ]
+            ########### deadlock. 
+            #[ run stm : -bench lot_example -def -threads 2 -inserts 100 -latm tx : : : test_lot_example_def_tx_t2_i100 ]
 
-            ########### fails with CHECK
+            ########### fails with CHECK  all-modes
             # /bin/sh: line 4:  4072 Aborted                 (core dumped) "bin/test_lit_def_t2.test/gcc-3.4.4/debug/threading-multi/test_lit_def_t2.exe" > "bin/test_lit_def_t2.test/gcc-3.4.4/debug/threading-multi/test_lit_def_t2.output" 2>&1
             ########### deadlock sometimes without CHECK. killed after 0:40. 00% CPU
-            #[ run stm : -bench lit_example -def -threads 2 -inserts 100 : : : test_lit_example_def_t2_i100 ]
+            #[ run stm : -bench lit_example -def -threads 2 -inserts 100 -latm full : : : test_lit_example_def_full_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench lit_example -def -threads 2 -inserts 100 -latm tm : : : test_lit_example_def_tm_t2_i100 ]
+            ########### deadlock
+            #[ run stm : -bench lit_example -def -threads 2 -inserts 100 -latm tx : : : test_lit_example_def_tx_t2_i100 ]
+            
 
             ########### livelock. killed after 3:50. 50% CPU
-            #[ run stm : -bench nested_tx -def -threads 2 -inserts 100 : : : test_nested_tx_def_t2_i100 ]
+            #[ run stm : -bench nested_tx -def -threads 2 -inserts 100 -latm full : : : test_nested_tx_def_full_t2_i100 ]
+            ##[ run stm : -bench nested_tx -def -threads 2 -inserts 100 -latm tm : : : test_nested_tx_def_tm_t2_i100 ]
+            ##[ run stm : -bench nested_tx -def -threads 2 -inserts 100 -latm tx : : : test_nested_tx_def_tx_t2_i100 ]
 
             [ run stm : -bench rbtree -def -threads 4 -inserts 100 : : : test_rbtree_def_t4_i100 ]
 
             [ run stm : -bench smart -def -threads 4 -inserts 100 : : : test_smart_def_t4_i100 ]
 
-            ########### fails
+            ########### fails all-modes
             # /bin/sh: line 4:  2376 Aborted                 (core dumped) "bin/test_using_linkedlist_def_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_using_linkedlist_def_t2_i1000.exe" > "bin/test_using_linkedlist_def_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_using_linkedlist_def_t2_i1000.output" 2>&1
-            [ run stm : -bench using_linkedlist -def -threads 2 -inserts 100 : : : test_using_linkedlist_def_t2_i100 ]
+            #[ run stm : -bench using_linkedlist -def -threads 2 -inserts 100 -latm full : : : test_using_linkedlist_def_full_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench using_linkedlist -def -threads 2 -inserts 100 -latm tm : : : test_using_linkedlist_def_tm_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench using_linkedlist -def -threads 2 -inserts 100 -latm tx : : : test_using_linkedlist_def_tx_t2_i100 ]
 
+            ########### fails all-modes
+            # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
+            #[ run stm : -bench hashmap_w_locks -def -threads 2 -inserts 100 -latm full : : : test_hashmap_w_locks_def_full_t2_i100 ]
             ########### fails
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench hashmap_w_locks -def -threads 2 -inserts 100 : : : test_hashmap_w_locks_def_t2_i100 ]
+            #[ run stm : -bench hashmap_w_locks -def -threads 2 -inserts 100 -latm tm : : : test_hashmap_w_locks_def_tm_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench hashmap_w_locks -def -threads 2 -inserts 100 -latm tx : : : test_hashmap_w_locks_def_tx_t2_i100 ]
 
             ########### fails
             # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
-            [ run stm : -bench list_hash_w_locks -def -threads 2 -inserts 100 : : : test_list_hash_w_locks_def_t2_i100 ]
+            #[ run stm : -bench list_hash_w_locks -def -threads 2 -inserts 100 -latm full : : : test_list_hash_w_locks_def_full_t2_i100 ]
+            [ run stm : -bench list_hash_w_locks -def -threads 2 -inserts 100 -latm tm : : : test_list_hash_w_locks_def_tm_t2_i100 ]
+            ########### fails
+            #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
+            #[ run stm : -bench list_hash_w_locks -def -threads 4 -inserts 100 -latm tm : : : test_list_hash_w_locks_def_tm_t4_i100 ]
+            [ run stm : -bench list_hash_w_locks -def -threads 2 -inserts 100 -latm tx : : : test_list_hash_w_locks_def_tx_t2_i100 ]
+            [ run stm : -bench list_hash_w_locks -def -threads 4 -inserts 100 -latm tx : : : test_list_hash_w_locks_def_tx_t4_i100 ]
     ;
 
     alias dir_invalid
@@ -127,54 +202,103 @@
 
             [ run stm : -bench hashmap -dir -threads 4 -inserts 100 : : : test_hashmap_dir_t4_i100 ]
 
-            ########### livelock. killed after 3:00 25% CPU
-            [ run stm : -bench ht -dir -threads 2 -inserts 100 : : : test_ht_dir_t2_i100 ]
+            [ run stm : -bench ht -dir -threads 2 -inserts 100 -latm full : : : test_ht_dir_full_t2_i100 ]
+            [ run stm : -bench ht -dir -threads 4 -inserts 100 -latm full : : : test_ht_dir_full_t4_i100 ]
+            [ run stm : -bench ht -dir -threads 2 -inserts 100 -latm tm : : : test_ht_dir_tm_t2_i100 ]
+            [ run stm : -bench ht -dir -threads 4 -inserts 100 -latm tm : : : test_ht_dir_tm_t4_i100 ]
+            [ run stm : -bench ht -dir -threads 2 -inserts 100 -latm tx : : : test_ht_dir_tx_t2_i100 ]
+            [ run stm : -bench ht -dir -threads 4 -inserts 100 -latm tx : : : test_ht_dir_tx_t4_i100 ]
 
             [ run stm : -bench isolated_int -dir -threads 4 -inserts 100 : : : test_isolated_int_dir_t2_i100 ]
 
             [ run stm : -bench linkedlist -dir -threads 4 -inserts 100 : : : test_linkedlist_dir_t4_i100 ]
 
-            [ run stm : -bench ll -dir -threads 2 -inserts 100 : : : test_ll_dir_t2_i100 ]
+            [ run stm : -bench ll -dir -threads 2 -inserts 100 -latm full : : : test_ll_dir_t2_full_i100 ]
+            [ run stm : -bench ll -dir -threads 4 -inserts 100 -latm full : : : test_ll_dir_t4_full_i100 ]
+            [ run stm : -bench ll -dir -threads 2 -inserts 100 -latm tm : : : test_ll_dir_t2_tm_i100 ]
+            [ run stm : -bench ll -dir -threads 4 -inserts 100 -latm tm : : : test_ll_dir_t4_tm_i100 ]
+            ########### fails 
+            #[ run stm : -bench ll -dir -threads 2 -inserts 100 -latm tx : : : test_ll_dir_t2_tx_i100 ]
+            ########### fails sometimes
+            [ run stm : -bench ll -dir -threads 4 -inserts 100 -latm tx : : : test_ll_dir_t4_tx_i100 ]
 
-            ########### fails with CHECK
+            ########### fails with CHECK  all-modes
             #/bin/sh: line 4:  3764 Aborted                 (core dumped) "bin/test_tx_linear_lock_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_tx_linear_lock_dir_t2.exe" > "bin/test_tx_linear_lock_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_tx_linear_lock_dir_t2.output" 2>&1
             #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
             ########### deadlock. without CHECK
-            #[ run stm : -bench tx_linear_lock -dir -threads 2 -inserts 100 : : : test_tx_linear_lock_dir_t2_i100 ]
-
-            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 2 -inserts 100 : : : test_isolated_int_lock_in_tx_dir_t2_i100 ]
-
-            ########### deadlock. killed after 0:20. 00% CPU
-            #[ run stm : -bench isolated_composed_int_lock -dir -threads 2 -inserts 100 : : : test_isolated_composed_int_lock_dir_t2_i100 ]
+            [ run stm : -bench tx_linear_lock -dir -threads 2 -inserts 100 -latm full : : : test_tx_linear_lock_dir_full_t2_i100 ]
+            ########### 
+            #[ run stm : -bench tx_linear_lock -dir -threads 4 -inserts 100 -latm full : : : test_tx_linear_lock_dir_full_t4_i100 ]
+            ########### fails 
+            #[ run stm : -bench tx_linear_lock -dir -threads 2 -inserts 100 -latm tm : : : test_tx_linear_lock_dir_tm_t2_i100 ]
+            ########### deadlock
+            #[ run stm : -bench tx_linear_lock -dir -threads 2 -inserts 100 -latm tx : : : test_tx_linear_lock_dir_tx_t2_i100 ]
+
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 2 -inserts 100 -latm full : : : test_isolated_int_lock_in_tx_dir_full_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 4 -inserts 100 -latm full : : : test_isolated_int_lock_in_tx_dir_full_t4_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 2 -inserts 100 -latm tm : : : test_isolated_int_lock_in_tx_dir_tm_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 4 -inserts 100 -latm tm : : : test_isolated_int_lock_in_tx_dir_tm_t4_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 2 -inserts 100 -latm tx : : : test_isolated_int_lock_in_tx_dir_tx_t2_i100 ]
+            [ run stm : -bench isolated_int_lock_in_tx -dir -threads 4 -inserts 100 -latm tx : : : test_isolated_int_lock_in_tx_dir_tx_t4_i100 ]
+
+            ########### deadlock. killed after 0:20. 00% CPU  all-modes  all-modes
+            #[ run stm : -bench isolated_composed_int_lock -dir -threads 2 -inserts 100 -latm full : : : test_isolated_composed_int_lock_dir_full_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench isolated_composed_int_lock -dir -threads 2 -inserts 100 -latm tm : : : test_isolated_composed_int_lock_dir_tm_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench isolated_composed_int_lock -dir -threads 2 -inserts 100 -latm tx : : : test_isolated_composed_int_lock_dir_tx_t2_i100 ]
 
             ###########  fails
             # /bin/sh: line 4:  3172 Aborted                 (core dumped) "bin/test_isolated_composed_int_lock2_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_dir_t2.exe" > "bin/test_isolated_composed_int_lock2_dir_t2.test/gcc-3.4.4/debug/threading-multi/test_isolated_composed_int_lock2_dir_t2.output" 2>&1
             #assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 40
             #      11 [sig] test_isolated_composed_int_lock_def_t2 3660 _cygtls::handle_except ions: Error while dumping state (probably corrupted stack)
-            [ run stm : -bench isolated_composed_int_lock2 -dir -threads 2 -inserts 100 : : : test_isolated_composed_int_lock2_dir_t2_i100 ]
+            #[ run stm : -bench isolated_composed_int_lock2 -dir -threads 2 -inserts 100  -latm full : : : test_isolated_composed_int_lock2_dir_full_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench isolated_composed_int_lock2 -dir -threads 2 -inserts 100  -latm tm : : : test_isolated_composed_int_lock2_dir_tm_t2_i100 ]
+            [ run stm : -bench isolated_composed_int_lock2 -dir -threads 2 -inserts 100  -latm tx : : : test_isolated_composed_int_lock2_dir_tx_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench isolated_composed_int_lock2 -dir -threads 4 -inserts 100  -latm tx : : : test_isolated_composed_int_lock2_dir_tx_t4_i100 ]
 
             [ run stm : -bench irrevocable_int -dir -threads 4 -inserts 100 : : : test_irrevocable_int_dir_t4_i100 ]
 
-            ########### deadlock. killed after 0:20. 00% CPU
-            #[ run stm : -bench lot_example -dir -threads 2 -inserts 100 : : : test_lot_example_dir_t2_i100 ]
-
-            ########### deadlock. killed after 0:40. 00% CPU
-            #[ run stm : -bench lit_example -dir -threads 2 -inserts 100 : : : test_lit_example_dir_t2_i100 ]
+            ########### deadlock. killed after 0:20. 00% CPU  all-modes
+            #[ run stm : -bench lot_example -dir -threads 2 -inserts 100 -latm full : : : test_lot_example_dir_full_t2_i100 ]
+            ########### deadlock
+            #[ run stm : -bench lot_example -dir -threads 2 -inserts 100 -latm tm : : : test_lot_example_dir_tm_t2_i100 ]
+            ########### deadlock
+            #[ run stm : -bench lot_example -dir -threads 2 -inserts 100 -latm tx : : : test_lot_example_dir_tx_t2_i100 ]
+
+            ########### deadlock. killed after 0:40. 00% CPU  all-modes
+            #[ run stm : -bench lit_example -dir -threads 2 -inserts 100 -latm full : : : test_lit_example_dir_full_t2_i100 ]
+            ########### fails 
+            #[ run stm : -bench lit_example -dir -threads 2 -inserts 100 -latm tm : : : test_lit_example_dir_tm_t2_i100 ]
+            ########### deadlock
+            #[ run stm : -bench lit_example -dir -threads 2 -inserts 100 -latm tx : : : test_lit_example_dir_tx_t2_i100 ]
 
             ########### livelock. killed after 3:00. 50% CPU
-            #[ run stm : -bench nested_tx -dir -threads 2 -inserts 100 : : : test_nested_tx_dir_t2_i100 ]
+            #[ run stm : -bench nested_tx -dir -threads 2 -inserts 100 -latm full : : : test_nested_tx_dir_full_t2_i100 ]
+            ##[ run stm : -bench nested_tx -dir -threads 2 -inserts 100 -latm tm : : : test_nested_tx_dir_tm_t2_i100 ]
+            ##[ run stm : -bench nested_tx -dir -threads 2 -inserts 100 -latm tx : : : test_nested_tx_dir_tx_t2_i100 ]
 
             [ run stm : -bench rbtree -dir -threads 4 -inserts 100 : : : test_rbtree_dir_t4_i100 ]
 
             [ run stm : -bench smart -dir -threads 4 -inserts 100 : : : test_smart_dir_t4_i100 ]
 
-            ########### fails
+            ########### fails all-modes
             #/bin/sh: line 4:   408 Aborted                 (core dumped) "bin/test_using_linkedlist_dir_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_using_linkedlist_dir_t2_i1000.exe" > "bin/test_using_linkedlist_dir_t2_i1000.test/gcc-3.4.4/debug/threading-multi/test_using_linkedlist_dir_t2_i1000.output" 2>&1
-            [ run stm : -bench using_linkedlist -dir -threads 2 -inserts 100 : : : test_using_linkedlist_dir_t2_i100 ]
-
-            [ run stm : -bench hashmap_w_locks -dir -threads 4 -inserts 100 : : : test_hashmap_w_locks_dir_t4_i100 ]
+            #[ run stm : -bench using_linkedlist -dir -threads 2 -inserts 100 -latm full : : : test_using_linkedlist_dir_full_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench using_linkedlist -dir -threads 2 -inserts 100 -latm tm : : : test_using_linkedlist_dir_tm_t2_i100 ]
+            ########### fails
+            #[ run stm : -bench using_linkedlist -dir -threads 2 -inserts 100 -latm tx : : : test_using_linkedlist_dir_tx_t2_i100 ]
 
-            [ run stm : -bench list_hash_w_locks -dir -threads 4 -inserts 100 : : : test_list_hash_w_locks_dir_t4_i100 ]
+            [ run stm : -bench hashmap_w_locks -dir -threads 4 -inserts 100 -latm full : : : test_hashmap_w_locks_dir_full_t4_i100 ]
+            [ run stm : -bench hashmap_w_locks -dir -threads 4 -inserts 100 -latm tm : : : test_hashmap_w_locks_dir_tm_t4_i100 ]
+            [ run stm : -bench hashmap_w_locks -dir -threads 4 -inserts 100 -latm tx : : : test_hashmap_w_locks_dir_tx_t4_i100 ]
+
+            [ run stm : -bench list_hash_w_locks -dir -threads 4 -inserts 100 -latm full : : : test_list_hash_w_locks_dir_full_t4_i100 ]
+            [ run stm : -bench list_hash_w_locks -dir -threads 4 -inserts 100 -latm tm : : : test_list_hash_w_locks_dir_tm_t4_i100 ]
+            [ run stm : -bench list_hash_w_locks -dir -threads 4 -inserts 100 -latm tx : : : test_list_hash_w_locks_dir_tx_t4_i100 ]
     ;
 
     alias examples
@@ -186,6 +310,8 @@
             [ link ../example/list.cpp ]
 
             [ run ../example/counter.cpp ]
+            # fails sometimes
+            # assertion "res==0" failed: file "../../../boost/synchro/pthread/mutex.hpp", line 52
             [ run ../example/numeric.cpp ]
             [ run ../example/tx/pointer.cpp ]
             [ run ../example/counter_ptr.cpp ]
Modified: sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -58,23 +58,31 @@
 
    for (int i = startingValue; i < endingValue/2; ++i)
    {
+      std::cout<< __LINE__ << " i= " << i << std::endl;
+      int count=0;
       for (transaction t; ; t.restart())
       {
-         t.add_tx_conflicting_lock(&lock1);
+          count++;
+        std::cout<< __LINE__ << " i="<<i << " end= " << endingValue/2 << " count= " << count << std::endl;
+         t.lock_conflict(&lock1);
          try
          {
+             std::cout<< __LINE__ << " lock" << std::endl;
             transaction::lock_(lock1);
             ++gInt.value();
-            cout << "\t" << gInt.value() << endl;
+            cout << __LINE__ << "\t" << gInt.value() << endl;
+             std::cout<< __LINE__ << " unlock" << std::endl;
             transaction::unlock_(lock1);
 
             SLEEP(50);
             // do nothing on purpose, allowing other threads time to see
             // intermediate state IF they can get lock1 (they shouldn't)
 
+             std::cout<< __LINE__ << " lock" << std::endl;
             transaction::lock_(lock1);
             --gInt.value();
-            cout << "\t" << gInt.value() << endl;
+            cout << __LINE__ << "\t" << gInt.value() << endl;
+             std::cout<< __LINE__ << " unlock" << std::endl;
             transaction::unlock_(lock1);
 
             t.end();
@@ -82,9 +90,12 @@
 
             break;
          }
-         catch (aborted_tx&) {}
+         catch (aborted_tx&) {
+             std::cout<< __LINE__ << " aborted_tx " << i << std::endl;
+        }
       }
    }
+    std::cout<< __LINE__ << std::endl;
 
    //--------------------------------------------------------------------------
    // last thread out sets the endTimer
@@ -92,59 +103,23 @@
    endTimer = time(0);
    finishThread(start);
 
+    std::cout<< __LINE__ << std::endl;
    if (*(int*)threadId != kMainThreadId)
    {
       transaction::terminate_thread();
-      pthread_exit(threadId);
+    std::cout<< __LINE__ << std::endl;
+      //pthread_exit(threadId);
    }
 
    return 0;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-#if 0
-static void* Test2(void *threadId)
-{
-   transaction::initialize_thread();
-   int start = *(int*)threadId;
-
-   int startingValue = start * 100000;
-   int endingValue = startingValue + kMaxInserts;
-
-   for (int i = startingValue; i < 100*endingValue; ++i)
-   {
-      try
-      {
-         transaction t;
-         t.add_tx_conflicting_lock(&lock1);
-         int val = t.r(gInt).value();
-         //transaction::lock(lock2);
-         cout << val << endl;
-         //transaction::unlock(lock2);
-         t.end();
-         SLEEP(10); // do nothing on purpose
-      } catch (aborted_tx&) {}
-   }
-
-   //--------------------------------------------------------------------------
-   // last thread out sets the endTimer
-   //--------------------------------------------------------------------------
-   endTimer = time(0);
-   finishThread(start);
-
-   if (*(int*)threadId != kMainThreadId)
-   {
-      transaction::terminate_thread();
-      pthread_exit(threadId);
-   }
-
-   return 0;
-}
-#endif
-///////////////////////////////////////////////////////////////////////////////
 static void* Test3(void *threadId)
 {
+   if (*(int*)threadId != kMainThreadId) {
    transaction::initialize_thread();
+   }
    int start = *(int*)threadId;
 
    int startingValue = 0;
@@ -170,12 +145,12 @@
    // last thread out sets the endTimer
    //--------------------------------------------------------------------------
    endTimer = time(0);
-   finishThread(start);
 
    if (*(int*)threadId != kMainThreadId)
    {
+   finishThread(start);
       transaction::terminate_thread();
-      pthread_exit(threadId);
+      //pthread_exit(threadId);
    }
 
    return 0;
@@ -185,6 +160,7 @@
 void TestIsolatedComposedIntLockInTx2()
 {
    transaction::initialize();
+   transaction::initialize_thread();
 
    pthread_t *threads = new pthread_t[kMaxThreads];
    int *threadId = new int[kMaxThreads];
@@ -206,8 +182,10 @@
 
    int mainThreadId = kMaxThreads-1;
 
-   Test3((void*)&mainThreadId);
+   //Test3((void*)&mainThreadId);
 
+   finishThread(mainThreadId);
+    transaction::terminate_thread();
    while (true)
    {
       if (threadsFinished.value() == kMaxThreads) break;
@@ -217,3 +195,43 @@
    cout << "gInt : " << gInt.value() << endl;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+#if 0
+static void* Test2(void *threadId)
+{
+   transaction::initialize_thread();
+   int start = *(int*)threadId;
+
+   int startingValue = start * 100000;
+   int endingValue = startingValue + kMaxInserts;
+
+   for (int i = startingValue; i < 100*endingValue; ++i)
+   {
+      try
+      {
+         transaction t;
+         t.lock_conflict(&lock1);
+         int val = t.r(gInt).value();
+         //transaction::lock(lock2);
+         cout << val << endl;
+         //transaction::unlock(lock2);
+         t.end();
+         SLEEP(10); // do nothing on purpose
+      } catch (aborted_tx&) {}
+   }
+
+   //--------------------------------------------------------------------------
+   // last thread out sets the endTimer
+   //--------------------------------------------------------------------------
+   endTimer = time(0);
+
+   if (*(int*)threadId != kMainThreadId)
+   {
+   finishThread(start);
+      transaction::terminate_thread();
+      pthread_exit(threadId);
+   }
+
+   return 0;
+}
+#endif
Modified: sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -194,7 +194,7 @@
    {
       for (transaction t;;t.restart())
         try {
-          t.add_tx_conflicting_lock(L2);
+          t.lock_conflict(L2);
           inc2();
           t.end(); break;
         } catch (aborted_tx&) {}
@@ -229,7 +229,7 @@
       for (transaction t;;t.restart())
         try {
 
-          t.add_tx_conflicting_lock(L3);
+          t.lock_conflict(L3);
           inc3();
           t.end(); break;
         } catch (aborted_tx&) {}
@@ -334,8 +334,8 @@
    arr8 = new native_trans<int>[kMaxArrSize];
 
    transaction::initialize();
-   transaction::tm_lock_conflict(L2);
-   transaction::tm_lock_conflict(L3);
+   //transaction::tm_lock_conflict(L2);
+   //transaction::tm_lock_conflict(L3);
 
    if (kTxIntenseWork == gWorkLoadType) txFactor = 5;
    if (kLockIntenseWork == gWorkLoadType) lockFactor = 10;
Modified: sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -223,8 +223,8 @@
       for (transaction t;;t.restart())
         try {
 
-          t.add_tx_conflicting_lock(L1);
-          t.add_tx_conflicting_lock(L2);
+          t.lock_conflict(L1);
+          t.lock_conflict(L2);
 
           for (int i = 0; i < kMaxArrSize; ++i)
           {
Modified: sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -246,9 +246,9 @@
    //latm::do_tm_lock_protection();
    latm::do_tx_lock_protection();
 
-   //transaction::tm_lock_conflict(&L);
-   //transaction::tm_lock_conflict(&L2);
-   //transaction::tm_lock_conflict(&L3);
+   transaction::tm_lock_conflict(&L);
+   transaction::tm_lock_conflict(&L2);
+   transaction::tm_lock_conflict(&L3);
 
    nested2();
    nested1();
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -272,7 +272,7 @@
       //----------------------------------------------------------------
       if (latm::instance().doing_tm_lock_protection() && 0 == (k+1) % 2)
       {
-         //transaction::add_tm_conflicting_lock(llist[index]->get_list_lock());
+         //transaction::tm_lock_conflict(llist[index]->get_list_lock());
          //cout << "TM-lock conflict added: " << index << endl;
       }
    }
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -427,13 +427,10 @@
    globalLinkedList = new LATM::LinkedList<int>;
    transaction::initialize();
 
-   if (latm::instance().doing_tm_lock_protection())
-   {
       for (int k = 1; k < kBuckets2; ++k)
       {
          transaction::tm_lock_conflict(globalHashMap->get_hash_lock(k));
       }
-   }
 
    threadsFinished.value() = 0;
    threadsStarted.value() = 0;
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -213,7 +213,7 @@
 
    for (int k = 1; k < kBuckets; ++k)
    {
-      transaction::add_tm_conflicting_lock(globalHashMap->get_hash_lock(k));
+      transaction::tm_lock_conflict(globalHashMap->get_hash_lock(k));
    }
 #endif
 
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -272,7 +272,7 @@
       //----------------------------------------------------------------
       if (latm::instance().doing_tm_lock_protection() && 0 == (k+1) % 2)
       {
-         //transaction::add_tm_conflicting_lock(llist[index]->get_list_lock());
+         //transaction::tm_lock_conflict(llist[index]->get_list_lock());
          //cout << "TM-lock conflict added: " << index << endl;
       }
    }
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.h	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.h	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -139,14 +139,7 @@
 
       transaction t;
 
-      if (latm::instance().doing_tx_lock_protection())
-      {
          t.lock_conflict(&list_lock_);
-      }
-      else if (latm::instance().doing_tm_lock_protection())
-      {
-         transaction::tm_lock_conflict(&list_lock_);
-      }
 
       for (; ;t.restart())
       {
Modified: sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -42,8 +42,8 @@
    {
       for (transaction t; ; t.restart())
       {
-         t.add_tx_conflicting_lock(&lock1);
-         t.add_tx_conflicting_lock(&lock2);
+         t.lock_conflict(&lock1);
+         t.lock_conflict(&lock2);
 
          try
          {
Modified: sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h	(original)
+++ sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h	2009-10-29 05:27:24 EDT (Thu, 29 Oct 2009)
@@ -144,7 +144,7 @@
       {
          if (eTxConflictingLockLatmProtection == latm::instance().protection())
          {
-            t.add_tx_conflicting_lock(&list_lock_);
+            t.lock_conflict(&list_lock_);
          }
 
          return internal_insert(node, t);
@@ -167,7 +167,7 @@
       {
          if (eTxConflictingLockLatmProtection == latm::instance().protection())
          {
-            t.add_tx_conflicting_lock(&list_lock_);
+            t.lock_conflict(&list_lock_);
          }
 
          return internal_lookup(val, t);