|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57293 - in sandbox/stm/branches/vbe: boost/stm/detail boost/stm/latm libs/stm/test
From: vicente.botet_at_[hidden]
Date: 2009-11-02 12:53:24
Author: viboes
Date: 2009-11-02 12:53:22 EST (Mon, 02 Nov 2009)
New Revision: 57293
URL: http://svn.boost.org/trac/boost/changeset/57293
Log:
TBoost.STM vbe: Using scoped locks in latm direct updata files.
Text files modified:
sandbox/stm/branches/vbe/boost/stm/detail/config.hpp | 5 -
sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp | 96 ++++++++++++++++--------------
sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp | 103 +++++++++++++++++---------------
sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp | 125 +++++++++++++++++++++++----------------
sandbox/stm/branches/vbe/boost/stm/latm/datatypes.hpp | 1
sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp | 7 -
sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2 | 9 ++
sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp | 15 ---
8 files changed, 191 insertions(+), 170 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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -104,6 +104,7 @@
//#define BOOST_STM_USE_BOOST_THREAD_ID 1
//#define BOOST_STM_USE_BOOST_MUTEX 1
#endif
+
#define BOOST_STM_NO_PARTIAL_SPECIALIZATION 1
///////////////////////////////////////////////////////////////////////////////
@@ -114,8 +115,6 @@
// Define BOOST_STM_ALLOWS_DELETERS when you want STM manage with others deleters than delete
#define BOOST_STM_ALLOWS_DELETERS 1
-#define BOOST_STM_USE_BOOST_SYNCHRO 1
-
///////////////////////////////////////////////////////////////////////////////
// BOOST_STM_LATM_STATIC_MODE
// BOOST_STM_LATM_STATIC_FULL_MODE
@@ -132,13 +131,11 @@
#define BOOST_STM_LATM_STATIC_MODE 1
#endif
-
///////////////////////////////////////////////////////////////////////////////
// Define BOOST_STM_LATM_GENERIC when you want Boost.STM to manage with arbitrary mutex
//#define BOOST_STM_LATM_GENERIC 1
-
///////////////////////////////////////////////////////////////////////////////
#endif // BOOST_STM_DETAIL_CONFIG_H
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -59,11 +59,11 @@
if (latm::instance().latmLockedLocks_.empty())
{
- //{
- //synchro::lock_guard<Mutex> lock_g(*general_lock());
- synchro::lock(*general_lock());
- //synchro::lock_guard<Mutex> lock_i(*inflight_lock());
- synchro::lock(*inflight_lock());
+ {
+ synchro::lock_guard<Mutex> lk_g(*general_lock());
+ //synchro::lock(*general_lock());
+ synchro::lock_guard<Mutex> lk_i(*inflight_lock());
+ //synchro::lock(*inflight_lock());
std::list<transaction*> txList;
for (InflightTxes::iterator i = transactionsInFlight_.begin();
@@ -78,8 +78,8 @@
}
else
{
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
return false;
}
}
@@ -94,9 +94,9 @@
//-----------------------------------------------------------------------
thread_conflicting_mutexes_set_all(true);
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
- //}
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
+ }
//-----------------------------------------------------------------------
// now we must stall until all in-flight transactions are gone, otherwise
@@ -110,8 +110,9 @@
catch (...)
{
// BUG ???
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
+ // BUG ???
throw;
}
@@ -147,41 +148,43 @@
//{
// TBR int val = lock(mutex);
// TBR if (0 != val) return val;
- synchro::lock(*mutex);
- //synchro::lock_guard<Mutex> lock_m(*mutex);
+ {//synchro::lock(*mutex);
+ synchro::unique_lock<Mutex> lk(*mutex);
- synchro::lock(latm::instance().latmMutex_);
- //synchro::lock_guard<Mutex> lock_l(latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
- try
- {
+ //try
+ //{
//--------------------------------------------------------------------
// if we are able to do the core lock work, break
//--------------------------------------------------------------------
- if (dir_do_core_full_pthread_lock_mutex(mutex, waitTime, aborted)) break;
- }
- catch (...)
- {
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ if (dir_do_core_full_pthread_lock_mutex(mutex, waitTime, aborted)) {
+ latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+ //synchro::unlock(latm::instance().latmMutex_);
+ lk.release();
+ return;
+ }
+ //}
+ //catch (...)
+ //{
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ // throw;
+ //}
//-----------------------------------------------------------------------
// we weren't able to do the core lock work, unlock our mutex and sleep
//-----------------------------------------------------------------------
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- //}
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ }
SLEEP(cm_lock_sleep_time());
waitTime += cm_lock_sleep_time();
++aborted;
}
- latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(latm::instance().latmMutex_);
- return;
}
//----------------------------------------------------------------------------
@@ -210,35 +213,38 @@
//if (lock_m) return true;
//int val = synchro::try_lock(*mutex);
//if (0 != val) return val;
- if (!synchro::try_lock(*mutex)) return false;
+ synchro::unique_lock<Mutex> lk(*mutex, synchro::try_to_lock);
+ if (!lk) return false;
+ //if (!synchro::try_lock(*mutex)) return false;
//synchro::lock(latmMutex_);
- synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
- try
- {
+ //try
+ //{
//-----------------------------------------------------------------------
// if !core done, since trylock, we cannot stall & retry - just exit
//-----------------------------------------------------------------------
if (!dir_do_core_full_pthread_lock_mutex(mutex, 0, 0))
{
//synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(latm::instance().latmMutex_);
//return -1;
return false;
}
- }
- catch (...)
- {
+ //}
+ //catch (...)
+ //{
//synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ //synchro::unlock(latm::instance().latmMutex_);
+ // throw;
+ //}
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
+ lk.release();
return true;
}
@@ -250,7 +256,7 @@
bool hasLock = true;
{
//synchro::lock(latmMutex_);
- synchro::lock_guard<Mutex> lock_l(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
if (transaction* t = get_inflight_tx_of_same_thread(false))
{
@@ -270,7 +276,7 @@
if (latm::instance().latmLockedLocks_.empty())
{
- synchro::lock_guard<Mutex> lock_l(*general_lock());
+ synchro::lock_guard<Mutex> lk_g(*general_lock());
//synchro::lock(*general_lock());
thread_conflicting_mutexes_set_all(false);
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -66,8 +66,10 @@
//--------------------------------------------------------------------------
if (latm::instance().latmLockedLocks_.empty())
{
- synchro::lock(*general_lock());
- synchro::lock(*inflight_lock());
+ {//synchro::lock(*general_lock());
+ synchro::lock_guard<Mutex> lk_g(*general_lock());
+ //synchro::lock(*inflight_lock());
+ synchro::lock_guard<Mutex> lk_i(*inflight_lock());
std::list<transaction*> txList;
for (InflightTxes::iterator i = transactionsInFlight_.begin();
@@ -82,8 +84,8 @@
}
else
{
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
return false;
}
}
@@ -98,8 +100,8 @@
//-----------------------------------------------------------------------
thread_conflicting_mutexes_set_all(true);
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ } //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
//-----------------------------------------------------------------------
// now we must stall until all in-flight transactions are gone, otherwise
@@ -123,10 +125,11 @@
{
latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
t->make_isolated();
- synchro::lock(*latm_lock());
+ {//synchro::lock(*latm_lock());
+ synchro::lock_guard<Mutex> lk_l(*latm_lock());
latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(*latm_lock());
- synchro::lock(*mutex);
+ }//synchro::unlock(*latm_lock());
+ synchro::lock(*mutex); // BUG: should't be before the map setting and making the tx isolated?
return;
}
@@ -134,40 +137,35 @@
for (;;)
{
- // TBR int val = lock(mutex);
- // TBR if (0 != val) return val;
- synchro::lock(*mutex);
+ {//synchro::lock(*mutex);
+ synchro::unique_lock<Mutex> lk(*mutex);
- synchro::lock(latm::instance().latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
- try
- {
//--------------------------------------------------------------------
// if we are able to do the core lock work, break
//--------------------------------------------------------------------
if (dir_do_core_tm_conflicting_lock_pthread_lock_mutex
- (mutex, waitTime, aborted)) break;
- }
- catch (...)
- {
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ (mutex, waitTime, aborted)) {
+ latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+ lk.release();
+ return;
+ }
//-----------------------------------------------------------------------
// we weren't able to do the core lock work, unlock our mutex and sleep
//-----------------------------------------------------------------------
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(*mutex);
+ } //synchro::unlock(latm::instance().latmMutex_);
SLEEP(cm_lock_sleep_time());
waitTime += cm_lock_sleep_time();
++aborted;
}
- latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(latm::instance().latmMutex_);
+ //latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+ //synchro::unlock(latm::instance().latmMutex_);
return;
}
@@ -181,42 +179,47 @@
{
latm::instance().must_be_in_tm_conflicting_lock_set(mutex);
t->make_isolated();
- synchro::lock(*latm_lock());
+ {//synchro::lock(*latm_lock());
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(*latm_lock());
- return synchro::try_lock(*mutex);
+ }//synchro::unlock(*latm_lock());
+ return synchro::try_lock(*mutex); // BUG: : should't be before the map setting and making the tx isolated?
}
//int val = synchro::try_lock(*mutex);
//if (0 != val) return val;
- if (!synchro::try_lock(*mutex)) return false;
+ synchro::unique_lock<Mutex> lk(*mutex, synchro::try_to_lock);
+ if (!lk) return false;
+ //if (!synchro::try_lock(*mutex)) return false;
- synchro::lock(latm::instance().latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
- try
- {
+ //try
+ //{
//-----------------------------------------------------------------------
// if !core done, since trylock, we cannot stall & retry - just exit
//-----------------------------------------------------------------------
if (!dir_do_core_tm_conflicting_lock_pthread_lock_mutex(mutex, 0, 0))
{
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
//return -1;
return false;
}
- }
- catch (...)
- {
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ //}
+ //catch (...)
+ //{
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ // throw;
+ //}
latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(latm::instance().latmMutex_);
// note: we do not release the transactionsInFlightMutex - this will prevents
// new transactions from starting until this lock is released
+ lk.release();
return true;
}
@@ -225,8 +228,10 @@
//----------------------------------------------------------------------------
inline void transaction::dir_tm_conflicting_lock_pthread_unlock_mutex(latm::mutex_type* mutex)
{
- synchro::lock(latm::instance().latmMutex_);
bool hasLock = true;
+ {//synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
+
if (transaction* t = get_inflight_tx_of_same_thread(false))
{
@@ -253,16 +258,16 @@
if (latm::instance().latmLockedLocks_.empty())
{
- synchro::lock(*general_lock());
-
+ //synchro::lock(*general_lock());
+ synchro::lock_guard<Mutex> lk_g(*general_lock());
thread_conflicting_mutexes_set_all(false);
- synchro::unlock(*general_lock());
+ //synchro::unlock(*general_lock());
}
}
latm::instance().latmLockedLocksOfThreadMap_.erase(mutex);
- synchro::unlock(latm::instance().latmMutex_);
+ }//synchro::unlock(latm::instance().latmMutex_);
//if (hasLock) return unlock(mutex);
//else return 0;
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -51,8 +51,10 @@
// set. do not keep in-flight transactions blocked once the transactions have
// been processed.
//--------------------------------------------------------------------------
- synchro::lock(*general_lock());
- synchro::lock(*inflight_lock());
+ //synchro::lock(*general_lock());
+ synchro::unique_lock<Mutex> lk_g(*general_lock());
+ //synchro::lock(*inflight_lock());
+ synchro::unique_lock<Mutex> lk_i(*inflight_lock());
std::list<transaction *> txList;
std::set<thread_id_t> txThreadId;
@@ -75,8 +77,8 @@
}
else
{
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
return false;
}
}
@@ -112,8 +114,10 @@
throw;
}
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ lk_g.unlock();
+ //synchro::unlock(*inflight_lock());
+ lk_i.unlock();
//-----------------------------------------------------------------------
// now wait until all the txs which conflict with this mutex are no longer
@@ -123,8 +127,11 @@
{
bool conflictingTxInFlight = false;
- synchro::lock(*general_lock());
- synchro::lock(*inflight_lock());
+ {
+ //synchro::lock(*general_lock());
+ synchro::unique_lock<Mutex> lk_g(*general_lock());
+ //synchro::lock(*inflight_lock());
+ synchro::unique_lock<Mutex> lk_i(*inflight_lock());
for (InflightTxes::iterator i = transactionsInFlight_.begin();
i != transactionsInFlight_.end(); ++i)
@@ -137,23 +144,27 @@
}
}
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
-
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
+ }
if (conflictingTxInFlight) SLEEP(10);
else return true;
}
- }
+ } else {
- synchro::unlock(*general_lock());
- synchro::unlock(*inflight_lock());
+ //synchro::unlock(*general_lock());
+ //synchro::unlock(*inflight_lock());
return true;
+ }
}
//----------------------------------------------------------------------------
// only allow one thread to execute any of these methods at a time
//----------------------------------------------------------------------------
+// Protected by: mutex is locked
+// Postcondition: mutex is locked
+//----------------------------------------------------------------------------
inline void transaction::dir_tx_conflicting_lock_pthread_lock_mutex(latm::mutex_type* mutex)
{
int waitTime = 0, aborted = 0;
@@ -192,10 +203,10 @@
t->add_to_currently_locked_locks(mutex);
t->add_to_obtained_locks(mutex);
- synchro::lock(latm::instance().latmMutex_);
- def_do_core_tx_conflicting_lock_pthread_lock_mutex
- (mutex, 0, 0, true);
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
+ def_do_core_tx_conflicting_lock_pthread_lock_mutex(mutex, 0, 0, true);
+ //synchro::unlock(latm::instance().latmMutex_);
return;
}
@@ -204,38 +215,44 @@
{
// TBR int val = lock(mutex);
// TBR if (0 != val) return val;
- synchro::lock(*mutex);
+ {//synchro::lock(*mutex);
+ synchro::unique_lock<Mutex> lk(*mutex);
- synchro::lock(latm::instance().latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
- try
- {
+ //try
+ //{
//--------------------------------------------------------------------
// if we are able to do the core lock work, break
//--------------------------------------------------------------------
if (dir_do_core_tx_conflicting_lock_pthread_lock_mutex
- (mutex, waitTime, aborted, false)) break;
- }
- catch (...)
- {
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ (mutex, waitTime, aborted, false)) {
+ latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
+ lk.release();
+ return;
+ }
+ //}
+ //catch (...)
+ //{
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ // throw;
+ //}
//-----------------------------------------------------------------------
// we weren't able to do the core lock work, unlock our mutex and sleep
//-----------------------------------------------------------------------
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
-
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ }
SLEEP(cm_lock_sleep_time());
waitTime += cm_lock_sleep_time();
++aborted;
}
- latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(latm::instance().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
@@ -254,9 +271,12 @@
//int val = synchro::try_lock(*mutex);
//if (0 != val) return val;
- if (!synchro::try_lock(*mutex)) return false;
+ synchro::unique_lock<Mutex> lk(*mutex, synchro::try_to_lock);
+ if (!lk) return false;
+ //if (!synchro::try_lock(*mutex)) return false;
- synchro::lock(latm::instance().latmMutex_);
+ //synchro::lock(latm::instance().latmMutex_);
+ synchro::lock_guard<Mutex> lk_l(latm::instance().latmMutex_);
if (transaction* t = get_inflight_tx_of_same_thread(false))
{
@@ -266,28 +286,29 @@
t->add_to_obtained_locks(mutex);
}
- try
- {
+ //try
+ //{
//-----------------------------------------------------------------------
// if !core done, since trylock, we cannot stall & retry - just exit
//-----------------------------------------------------------------------
if (!dir_do_core_tx_conflicting_lock_pthread_lock_mutex(mutex, 0, 0, txIsIrrevocable))
{
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
//return -1;
return false;
}
- }
- catch (...)
- {
- synchro::unlock(*mutex);
- synchro::unlock(latm::instance().latmMutex_);
- throw;
- }
+ //}
+ //catch (...)
+ //{
+ //synchro::unlock(*mutex);
+ //synchro::unlock(latm::instance().latmMutex_);
+ // throw;
+ //}
latm::instance().latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
- synchro::unlock(latm::instance().latmMutex_);
+ //synchro::unlock(latm::instance().latmMutex_);
+ lk.release();
// note: we do not release the transactionsInFlightMutex - this will prevents
// new transactions from starting until this lock is released
@@ -299,9 +320,9 @@
//----------------------------------------------------------------------------
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());
- synchro::lock_guard<Mutex> autolock_i(*inflight_lock());
+ synchro::lock_guard<Mutex> lk_l(*latm_lock());
+ synchro::lock_guard<Mutex> lk_g(*general_lock());
+ synchro::lock_guard<Mutex> lk_i(*inflight_lock());
bool hasLock = true;
if (transaction* t = get_inflight_tx_of_same_thread(true))
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -35,7 +35,6 @@
typedef std::set<thread_id_t> thread_id_set;
typedef std::set<mutex_type*> mutex_set;
- //typedef std::map<thread_id_t, mutex_set* > thread_mutex_set_map;
typedef std::map<thread_id_t, mutex_set* > thread_id_mutex_set_map;
//typedef std::map<latm::mutex_type*, thread_id_set > MutexThreadSetMap;
Modified: sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/latm/full_mode.hpp 2009-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -75,12 +75,7 @@
return ;
}
-//-----------------------------------------------------------------------------
- //int lock(mutex_type& lock);
- //int try_lock(mutex_type& lock);
- //int unlock(mutex_type& lock);
-
- };
+};
}}}
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -324,7 +324,14 @@
[ run ../example/non_tx_counter.cpp ]
;
+ alias def
+ : def_invalid
+ ;
+
+ alias dir
+ : dir_invalid
+ ;
alias all
- : def_invalid dir_invalid examples
+ : def dir examples
;
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-11-02 12:53:22 EST (Mon, 02 Nov 2009)
@@ -58,31 +58,25 @@
for (int i = startingValue; i < endingValue/2; ++i)
{
- std::cout<< __LINE__ << " i= " << i << std::endl;
int count=0;
for (transaction t; ; t.restart())
{
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 << __LINE__ << "\t" << gInt.value() << endl;
- std::cout<< __LINE__ << " unlock" << std::endl;
+ cout << "\t" << gInt.value() << 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 << __LINE__ << "\t" << gInt.value() << endl;
- std::cout<< __LINE__ << " unlock" << std::endl;
+ cout << "\t" << gInt.value() << endl;
transaction::unlock_(lock1);
t.end();
@@ -95,7 +89,6 @@
}
}
}
- std::cout<< __LINE__ << std::endl;
//--------------------------------------------------------------------------
// last thread out sets the endTimer
@@ -103,11 +96,9 @@
endTimer = time(0);
finishThread(start);
- std::cout<< __LINE__ << std::endl;
if (*(int*)threadId != kMainThreadId)
{
transaction::terminate_thread();
- std::cout<< __LINE__ << std::endl;
//pthread_exit(threadId);
}
@@ -182,7 +173,7 @@
int mainThreadId = kMaxThreads-1;
- //Test3((void*)&mainThreadId);
+ Test3((void*)&mainThreadId);
finishThread(mainThreadId);
transaction::terminate_thread();
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk