Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57352 - in sandbox/stm/branches/vbe/boost: stm stm/contention_managers stm/latm stm/tx synchro/detail synchro/lockable synchro/lockers synchro/poly synchro/pthread
From: vicente.botet_at_[hidden]
Date: 2009-11-04 06:09:18


Author: viboes
Date: 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
New Revision: 57352
URL: http://svn.boost.org/trac/boost/changeset/57352

Log:
TBoost.STM vbe: Added files that should be committed on precedents commits

Added:
   sandbox/stm/branches/vbe/boost/stm/contention_managers.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/contention_managers/poly_contention_manager.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/abstract_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/all_in_one_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/static_full_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/static_tm_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/static_tx_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/tm_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/latm/tx_mode.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/non_tx.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/synch.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/tx.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/tx/smart_ptr.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/txw.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/detail/defaulted_functions.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/detail/deleted_functions.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/lockers/var_lock_guard.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/poly/adaptive_lock.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/poly/lock_adapter.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/synchro/poly/ref_lock_adapter.hpp (contents, props changed)
Text files modified:
   sandbox/stm/branches/vbe/boost/synchro/lockable/lock.hpp | 6 ++++++
   sandbox/stm/branches/vbe/boost/synchro/lockable/try_lock.hpp | 7 +++++++
   sandbox/stm/branches/vbe/boost/synchro/lockable/unlock.hpp | 6 ++++++
   sandbox/stm/branches/vbe/boost/synchro/pthread/mutex.hpp | 4 ++--
   4 files changed, 21 insertions(+), 2 deletions(-)

Added: sandbox/stm/branches/vbe/boost/stm/contention_managers.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/contention_managers.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_CONTENTION_MANAGERS__HPP
+#define BOOST_STM_CONTENTION_MANAGERS__HPP
+
+#include <boost/stm/detail/config.hpp>
+
+#include <boost/stm/contention_managers/base_contention_manager.hpp>
+#include <boost/stm/contention_managers/contention_manager.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#endif // BOOST_STM_CONTENTION_MANAGERS__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/contention_managers/poly_contention_manager.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/contention_managers/poly_contention_manager.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,137 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//-----------------------------------------------------------------------------
+// forward declaration
+//-----------------------------------------------------------------------------
+template <class ContentionManagerPolicy>
+class basic_transaction;
+
+class poly_contention_manager;
+
+//-----------------------------------------------------------------------------
+class base_contention_manager
+{
+public:
+ virtual void abort_on_new(basic_transaction<poly_contention_manager> const &t) = 0;
+ virtual void abort_on_delete(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in) = 0;
+
+ virtual void abort_on_read(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in) = 0;
+ virtual void abort_on_write(basic_transaction<poly_contention_manager> &t,
+ base_transaction_object const &in) = 0;
+
+ virtual bool abort_before_commit(basic_transaction<poly_contention_manager> const &t) = 0;
+
+ virtual bool permission_to_abort
+ (basic_transaction<poly_contention_manager> const &lhs, basic_transaction<poly_contention_manager> const &rhs) = 0;
+
+ virtual bool allow_lock_to_abort_tx(int const & lockWaitTime, int const &lockAborted,
+ bool txIsIrrevocable, basic_transaction<poly_contention_manager> const &rhs) = 0;
+
+ virtual int lock_sleep_time() =0;
+
+ virtual void perform_isolated_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &) = 0;
+ virtual void perform_irrevocable_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &) = 0;
+
+ virtual ~base_contention_manager() {};
+};
+
+class poly_contention_manager
+{
+protected:
+ static base_contention_manager *cm_;
+
+public:
+ static void contention_manager(base_contention_manager *rhs) { delete cm_; cm_ = rhs; }
+ static base_contention_manager* get_contention_manager() { return cm_; }
+
+ void abort_on_new(basic_transaction<poly_contention_manager> const &t)
+ { cm_->abort_on_new(t);}
+ void abort_on_delete(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in)
+ { cm_->abort_on_delete(t,in);}
+
+ void abort_on_read(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in)
+ { cm_->abort_on_read(t,in);}
+ void abort_on_write(basic_transaction<poly_contention_manager> &t,
+ base_transaction_object const &in)
+ { cm_->abort_on_write(t,in);}
+
+ bool abort_before_commit(basic_transaction<poly_contention_manager> const &t)
+ { return cm_abort_before_commit(t);}
+
+ bool permission_to_abort(basic_transaction<poly_contention_manager> const &lhs,
+ basic_transaction<poly_contention_manager> const &rhs)
+ { return cm_->permission_to_abort(lhs,rhs);}
+
+ bool cm_permission_to_abort(basic_transaction<poly_contention_manager> const &lhs, std::list<transaction*> &rhs) {
+ return cm_->permission_to_abort(lhs,rhs);
+ }
+
+ bool allow_lock_to_abort_tx(int const & lockWaitTime, int const &lockAborted, bool txIsIrrevocable,
+ basic_transaction<poly_contention_manager> const &rhs)
+ { return cm_->allow_lock_to_abort_tx(lockWaitTime,lockAborted,txIsIrrevocable,rhs);}
+
+ int lock_sleep_time()
+ { return cm_->lock_sleep_time();}
+
+ void perform_isolated_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &t)
+ { cm_->perform_isolated_tx_wait_priority_promotion(t);}
+ void perform_irrevocable_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &t)
+ { cm_->perform_irrevocable_tx_wait_priority_promotion(t);}
+
+};
+
+//-----------------------------------------------------------------------------
+template <typename Base>
+class default_contention_manager : public Base
+{
+public:
+ //--------------------------------------------------------------------------
+ void abort_on_new(basic_transaction<poly_contention_manager> const &t);
+ void abort_on_delete(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in);
+
+ void abort_on_read(basic_transaction<poly_contention_manager> const &t,
+ base_transaction_object const &in);
+ void abort_on_write(basic_transaction<poly_contention_manager> &t,
+ base_transaction_object const &in);
+
+ bool abort_before_commit(basic_transaction<poly_contention_manager> const &t)
+ {
+ return false;
+ }
+
+ bool permission_to_abort
+ (basic_transaction<poly_contention_manager> const &lhs, basic_transaction<poly_contention_manager> const &rhs)
+ { return true; }
+
+ bool allow_lock_to_abort_tx(int const & lockWaitTime, int const &lockAborted,
+ bool txIsIrrevocable, basic_transaction<poly_contention_manager> const &rhs);
+
+ int lock_sleep_time() { return 10; }
+ void perform_isolated_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &);
+ void perform_irrevocable_tx_wait_priority_promotion(basic_transaction<poly_contention_manager> &);
+};
+
+
+#ifndef BOOST_STM_CONTENTION_MANAGER
+#define BOOST_STM_CONTENTION_MANAGER ::boost::stm::poly_contention_manager
+#define BOOST_STM_CONTENTION_MANAGER_POLY
+#endif
+
+typedef basic_transaction<BOOST_STM_CONTENTION_MANAGER> transaction;

Added: sandbox/stm/branches/vbe/boost/stm/latm/abstract_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/abstract_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,46 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_ABSTRACT_MODE__HPP
+#define BOOST_STM_LATM_ABSTRACT_MODE__HPP
+
+#include <boost/stm/detail/config.hpp>
+#include <boost/stm/latm/datatypes.hpp>
+
+namespace boost { namespace stm { namespace latm {
+
+ class abstract_mode {
+ public:
+ virtual latm_type const protection() =0;
+ virtual std::string const protection_str()=0;
+
+ virtual bool doing_full_lock_protection()=0;
+ virtual bool doing_tm_lock_protection()=0;
+ virtual bool doing_tx_lock_protection()=0;
+
+ virtual bool can_go_inflight()=0;
+
+ virtual void tm_lock_conflict(latm::mutex_type &lock)=0;
+ virtual void tm_lock_conflict(latm::mutex_type* inLock)=0;
+
+ //virtual void lock(mutex_type& lock);
+ //virtual bool try_lock(mutex_type& lock);
+ //virtual void unlock(mutex_type& lock);
+ virtual ~abstract_mode() {}
+ };
+
+}}}
+
+#endif // BOOST_STM_LATM_DYNAMIC__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/all_in_one_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/all_in_one_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,148 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_ALL_IN_ONE_MODE__HPP
+#define BOOST_STM_LATM_ALL_IN_ONE_MODE__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 {
+
+//-----------------------------------------------------------------------------
+class all_in_one_mode : public base_mode<> {
+ latm_type eLatmType_;
+public:
+//-----------------------------------------------------------------------------
+ all_in_one_mode() : 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_;
+ }
+
+//-----------------------------------------------------------------------------
+ bool can_go_inflight()
+ {
+ // if we're doing full lock protection, allow transactions
+ // to start only if no locks are obtained or the only lock that
+ // is obtained is on this_thread::get_id()
+ if (doing_full_lock_protection())
+ {
+ for (latm::mutex_thread_id_map::iterator j = latmLockedLocksOfThreadMap_.begin();
+ j != latmLockedLocksOfThreadMap_.end(); ++j)
+ {
+ if (this_thread::get_id() != j->second)
+ {
+ return false;
+ }
+ }
+ }
+
+ // if we're doing tm lock protection, allow transactions
+ // to start only if
+ else if (doing_tm_lock_protection())
+ {
+ for (latm::mutex_set::iterator i = tmConflictingLocks_.begin(); i != tmConflictingLocks_.end(); ++i)
+ {
+ // if one of your conflicting locks is currently locked ...
+ if (latmLockedLocks_.end() != latmLockedLocks_.find(*i))
+ {
+ // if it is locked by our thread, it is ok ... otherwise it is not
+ latm::mutex_thread_id_map::iterator j = latmLockedLocksOfThreadMap_.find(*i);
+
+ if (j != latmLockedLocksOfThreadMap_.end() &&
+ this_thread::get_id() != j->second)
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+//-----------------------------------------------------------------------------
+ void tm_lock_conflict(latm::mutex_type &lock)
+ {
+ tm_lock_conflict(&lock);
+ }
+ void tm_lock_conflict(latm::mutex_type* inLock)
+ {
+ if (!this->doing_tm_lock_protection()) return;
+
+ synchro::lock_guard<Mutex> lock_l(latmMutex_);
+
+ //-------------------------------------------------------------------------
+ // insert can throw an exception
+ //-------------------------------------------------------------------------
+ tmConflictingLocks_.insert(inLock);
+ }
+
+};
+
+typedef all_in_one_mode latm_mode;
+
+struct mode {
+ static latm_mode instance_;
+};
+
+inline all_in_one_mode& instance() {
+ return mode::instance_;
+}
+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_ALL_IN_ONE_MODE__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/static_full_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/static_full_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_STATIC_TX__HPP
+#define BOOST_STM_LATM_STATIC_TX__HPP
+
+#include <boost/stm/detail/config.hpp>
+#include <boost/stm/latm/datatypes.hpp>
+#include <boost/stm/latm/full_mode.hpp>
+
+namespace boost { namespace stm { namespace latm {
+ typedef full_mode<> latm_mode;
+ struct mode {
+ static latm_mode instance_;
+ };
+ inline void do_full_lock_protection() {
+ }
+ inline void do_tm_lock_protection() {
+ }
+ inline void do_tx_lock_protection() {
+ }
+ inline latm_mode& instance() {
+ return mode::instance_;
+ }
+
+}}}
+
+#endif // BOOST_STM_LATM_STATIC_TX__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/static_tm_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/static_tm_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_STATIC_TX__HPP
+#define BOOST_STM_LATM_STATIC_TX__HPP
+
+#include <boost/stm/detail/config.hpp>
+#include <boost/stm/latm/datatypes.hpp>
+#include <boost/stm/latm/tm_mode.hpp>
+
+namespace boost { namespace stm { namespace latm {
+ typedef tm_mode<> latm_mode;
+ struct mode {
+ static latm_mode instance_;
+ };
+ inline void do_full_lock_protection() {
+ }
+ inline void do_tm_lock_protection() {
+ }
+ inline void do_tx_lock_protection() {
+ }
+ inline latm_mode& instance() {
+ return mode::instance_;
+ }
+
+}}}
+
+#endif // BOOST_STM_LATM_STATIC_TX__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/static_tx_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/static_tx_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_STATIC_TX__HPP
+#define BOOST_STM_LATM_STATIC_TX__HPP
+
+#include <boost/stm/detail/config.hpp>
+#include <boost/stm/latm/datatypes.hpp>
+#include <boost/stm/latm/tx_mode.hpp>
+
+namespace boost { namespace stm { namespace latm {
+ typedef tx_mode<> latm_mode;
+ struct mode {
+ static latm_mode instance_;
+ };
+ inline void do_full_lock_protection() {
+ }
+ inline void do_tm_lock_protection() {
+ }
+ inline void do_tx_lock_protection() {
+ }
+ inline latm_mode& instance() {
+ return mode::instance_;
+ }
+
+}}}
+
+#endif // BOOST_STM_LATM_STATIC_TX__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/tm_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/tm_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,90 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TM_MIXIN__HPP
+#define BOOST_STM_LATM_TM_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 {
+
+//-----------------------------------------------------------------------------
+template <typename Base=static_mode>
+class tm_mode : public base_mode<Base> {
+public:
+ ~tm_mode() {}
+
+ latm_type const protection() { return eTmConflictingLockLatmProtection; }
+ std::string const protection_str() {
+ return "tm_protect";
+ }
+
+ bool doing_full_lock_protection() {
+ return false;
+ }
+ bool doing_tm_lock_protection() {
+ return true;
+ }
+ bool doing_tx_lock_protection() {
+ return false;
+ }
+
+//-----------------------------------------------------------------------------
+ bool can_go_inflight()
+ {
+ // allow transactions
+ // to start only if
+ for (latm::mutex_set::iterator i = this->tmConflictingLocks_.begin(); i != this->tmConflictingLocks_.end(); ++i)
+ {
+ // if one of your conflicting locks is currently locked ...
+ if (this->latmLockedLocks_.end() != this->latmLockedLocks_.find(*i))
+ {
+ // if it is locked by our thread, it is ok ... otherwise it is not
+ latm::mutex_thread_id_map::iterator j = this->latmLockedLocksOfThreadMap_.find(*i);
+
+ if (j != this->latmLockedLocksOfThreadMap_.end() &&
+ this_thread::get_id() != j->second)
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+//-----------------------------------------------------------------------------
+ void tm_lock_conflict(latm::mutex_type &lock)
+ {
+ tm_lock_conflict(&lock);
+ }
+ void tm_lock_conflict(latm::mutex_type* inLock)
+ {
+ synchro::lock_guard<Mutex> lock_l(this->latmMutex_);
+
+ //-------------------------------------------------------------------------
+ // insert can throw an exception
+ //-------------------------------------------------------------------------
+ this->tmConflictingLocks_.insert(inLock);
+ }
+
+};
+
+}}}
+
+#endif // BOOST_STM_LATM_TM_MIXIN__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/latm/tx_mode.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/latm/tx_mode.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,69 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TX_MIXIN__HPP
+#define BOOST_STM_LATM_TX_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 {
+
+//-----------------------------------------------------------------------------
+template <typename Base=static_mode>
+class tx_mode : public base_mode<Base> {
+public:
+ ~tx_mode() {}
+//-----------------------------------------------------------------------------
+ latm_type const protection() { return eTxConflictingLockLatmProtection; }
+ std::string const protection_str() {
+ return "tx_protect";
+ }
+
+ bool doing_full_lock_protection() {
+ return false;
+ }
+ bool doing_tm_lock_protection() {
+ return false;
+ }
+ bool doing_tx_lock_protection() {
+ return true;
+ }
+
+//-----------------------------------------------------------------------------
+ bool can_go_inflight()
+ {
+ return true;
+ }
+
+//-----------------------------------------------------------------------------
+ void tm_lock_conflict(latm::mutex_type &lock)
+ {
+ tm_lock_conflict(&lock);
+ }
+ void tm_lock_conflict(latm::mutex_type* inLock)
+ {
+ return ;
+ }
+
+};
+
+}}}
+
+#endif // BOOST_STM_LATM_TX_MIXIN__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/non_tx.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_NON_TX__HPP
+#define BOOST_STM_NON_TX__HPP
+
+#include <boost/stm/non_tx/object.hpp>
+#include <boost/stm/non_tx/numeric.hpp>
+#include <boost/stm/non_tx/pointer.hpp>
+#include <boost/stm/non_tx/smart_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#endif // TRANSACTION_H
+
+

Added: sandbox/stm/branches/vbe/boost/stm/synch.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/synch.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_SYNCH__HPP
+#define BOOST_STM_SYNCH__HPP
+
+#include <boost/stm/synch/auto_lock.hpp>
+#include <boost/stm/synch/mutex.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#endif // TRANSACTION_H
+
+

Added: sandbox/stm/branches/vbe/boost/stm/tx.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/tx.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,30 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX__HPP
+#define BOOST_STM_TX__HPP
+
+#include <boost/stm/detail/config.hpp>
+
+#include <boost/stm/tx/shallow_transaction_object.hpp>
+#include <boost/stm/tx/deep_transaction_object.hpp>
+#include <boost/stm/tx_ptr.hpp>
+#include <boost/stm/tx/object.hpp>
+#include <boost/stm/tx/numeric.hpp>
+#include <boost/stm/tx/pointer.hpp>
+//#include <boost/stm/tx/smart_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#endif // TRANSACTION_H
+
+

Added: sandbox/stm/branches/vbe/boost/stm/tx/smart_ptr.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/tx/smart_ptr.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,22 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX_SMART_PTR__HPP
+#define BOOST_STM_TX_SMART_PTR__HPP
+
+//-----------------------------------------------------------------------------
+#include <boost/stm/tx_ptr.hpp>
+//-----------------------------------------------------------------------------
+#endif // BOOST_STM_TX_SMART_PTR__HPP
+
+

Added: sandbox/stm/branches/vbe/boost/stm/txw.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/txw.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,26 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TXW__HPP
+#define BOOST_STM_TXW__HPP
+
+#include <boost/stm/txw/transactional_object.hpp>
+//#include <boost/stm/tx/object.hpp>
+//#include <boost/stm/tx/numeric.hpp>
+//#include <boost/stm/tx/pointer.hpp>
+#include <boost/stm/txw/smart_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#endif // TRANSACTION_H
+
+

Added: sandbox/stm/branches/vbe/boost/synchro/detail/defaulted_functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/detail/defaulted_functions.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,59 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-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 for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __BOOST_DEFAULTED_FUNCTIONS__HPP
+#define __BOOST_DEFAULTED_FUNCTIONS__HPP
+
+#include <memory>
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_DEFAULTED_FUNCTIONS)
+
+ #define BOOST_DEFAULT_CONSTRUCTOR_DCL_DEFAULT(T) \
+ T()=default;
+
+ #define BOOST_DEFAULT_CONSTRUCTOR_DEF_DEFAULT(T) \
+ T::T()=default;
+
+ #define BOOST_COPY_ASSIGNEMENT_DCL=DEFAULT(T) \
+ T& operator=(const T& rhs)=default;
+
+ #define BOOST_COPY_ASSIGNEMENT_DEF=DEFAULT(T) \
+ T& T::operator=(const T& rhs)=default;
+
+#else // !defined(BOOST_HAS_DEFAULTED_FUNCTIONS)
+
+ #define BOOST_DEFAULT_CONSTRUCTOR_DCL_DEFAULT(T) \
+ T(){};
+
+ #define BOOST_DEFAULT_CONSTRUCTOR_DEFAULT(T) \
+ T(){};
+
+ #define BOOST_DEFAULT_CONSTRUCTOR_DEF_DEFAULT(T) \
+ T::T(){};
+
+
+ #define BOOST_COPY_ASSIGNEMENT_DCL_DEFAULT(T) \
+ T& operator=(const T& rhs) { \
+ T tmp(rhs); \
+ swap(tmp); \
+ return this; \
+ }
+
+ #define BOOST_COPY_ASSIGNEMENT_DEF_DEFAULT(T) \
+ T& T::operator=(const T& rhs) { \
+ T tmp(rhs); \
+ swap(tmp); \
+ return this; \
+ }
+
+#endif // !defined(BOOST_HAS_DEFAULTED_FUNCTIONS)
+#endif

Added: sandbox/stm/branches/vbe/boost/synchro/detail/deleted_functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/detail/deleted_functions.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,168 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-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 for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef __BOOST_DELETED_FUNCTIONS__HPP
+#define __BOOST_DELETED_FUNCTIONS__HPP
+
+#include <memory>
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_DELETED_FUNCTIONS)
+
+#define BOOST_DESTRUCTOR_DELETE(T) \
+ ~T()=delete;
+
+#define BOOST_DEFAULT_CONSTRUCTOR_DELETE(T) \
+ T()=delete;
+
+#define BOOST_COPY_CONSTRUCTOR_DELETE(T) \
+ T(const T&)=delete;
+
+#define BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(T) \
+ T(T&)=delete;
+
+#define BOOST_COPY_ASSIGNEMENT_DELETE(T) \
+ T& operator=(const T&)=delete;
+
+#define BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(T) \
+ const T& operator=(T&)=delete;
+
+#define BOOST_SEQUENCE_DELETE(T) \
+ T operator,(T)=delete;
+
+#define BOOST_ADRESS_OF_DELETE(T) \
+ const T* operator&() const =delete;
+
+#define BOOST_NON_CONST_ADRESS_OF_DELETE(T) \
+ T* operator&()=delete;
+
+#define BOOST_INDIRECTION_DELETE(T) \
+ const T& operator*() const =delete;
+
+#define BOOST_NON_CONST_INDIRECTION_DELETE(T) \
+ T& operator*()=delete;
+
+#define BOOST_MEMBER_ACCESS_DELETE(T) \
+ const T* operator->() const =delete;
+
+#define BOOST_NON_CONST_MEMBER_ACCESS_DELETE(T) \
+ T* operator->()=delete;
+
+#define BOOST_NEW_DELETE(T) \
+ void* operator new(unsigned)=delete;
+
+#define BOOST_NEW_ARRAY_DELETE(T) \
+ void* operator new[](unsigned)=delete;
+
+#define BOOST_NEW_PLACEMENT_DELETE(T) \
+ void operator delete(void*, unsigned)=delete;
+
+#define BOOST_NEW_ARRAY_PLACEMENT_DELETE(T) \
+ void operator delete[](void*, unsigned)=delete;
+
+#else // !defined(BOOST_HAS_DELETED_FUNCTIONS)
+
+#define BOOST_DESTRUCTOR_DELETE(T) \
+private: \
+ ~T(); \
+public:
+
+#define BOOST_DEFAULT_CONSTRUCTOR_DELETE(T) \
+private: \
+ T(); \
+public:
+
+#define BOOST_COPY_CONSTRUCTOR_DELETE(T) \
+private: \
+ T(const T&); \
+public:
+
+#define BOOST_NON_CONST_COPY_CONSTRUCTOR_DELETE(T) \
+private: \
+ T(T&); \
+public:
+
+#define BOOST_COPY_ASSIGNEMENT_DELETE(T) \
+private: \
+ T& operator=(const T&); \
+public:
+
+#define BOOST_NON_CONST_COPY_ASSIGNEMENT_DELETE(T) \
+private: \
+ T& operator=(T&); \
+public:
+
+#define BOOST_SEQUENCE_DELETE(T) \
+private: \
+ T operator,(T); \
+public:
+
+#define BOOST_ADRESS_OF_DELETE(T) \
+private: \
+ const T* operator&() const; \
+public:
+
+#define BOOST_NON_CONST_ADRESS_OF_DELETE(T) \
+private: \
+ T* operator&(); \
+public:
+
+#define BOOST_INDIRECTION_DELETE(T) \
+private: \
+ const T& operator*() const; \
+public:
+
+#define BOOST_NON_CONST_INDIRECTION_DELETE(T) \
+private: \
+ T& operator*(); \
+public:
+
+#define BOOST_MEMBER_ACCESS_DELETE(T) \
+private: \
+ const T* operator->() const; \
+public:
+
+#define BOOST_NON_CONST_MEMBER_ACCESS_DELETE(T) \
+private: \
+ T* operator->(); \
+public:
+
+#define BOOST_NEW_DELETE(T) \
+private: \
+ void* operator new(unsigned); \
+public:
+
+#define BOOST_NEW_ARRAY_DELETE(T) \
+private: \
+ void* operator new[](unsigned); \
+public:
+
+#define BOOST_NEW_PLACEMENT_DELETE(T) \
+private: \
+ void operator delete(void*, unsigned); \
+public:
+
+#define BOOST_NEW_ARRAY_PLACEMENT_DELETE(T) \
+private: \
+ void operator delete[](void*, unsigned); \
+public:
+
+#endif
+
+#define BOOST_HEAP_ALLOCATEION_DELETE(T) \
+ BOOST_NEW_DELETE(T) \
+ BOOST_NEW_ARRAY_DELETE(T) \
+ BOOST_NEW_PLACEMENT_DELETE(T) \
+ BOOST_NEW_ARRAY_PLACEMENT_DELETE(T)
+
+#endif // !defined(BOOST_HAS_DELETED_FUNCTIONS)
+
+

Modified: sandbox/stm/branches/vbe/boost/synchro/lockable/lock.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/lockable/lock.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/lockable/lock.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -14,6 +14,8 @@
 #ifndef BOOST_SYNCHO_LOCKABLE_LOCK_HPP
 #define BOOST_SYNCHO_LOCKABLE_LOCK_HPP
 
+#include <assert.h>
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
@@ -21,7 +23,11 @@
 
     template< typename Lockable >
     inline void lock(Lockable& lockable) {
+ try {
         lockable.lock();
+ } catch (...) {
+ assert(false && "synchro::lock exception");
+ }
     }
 
 }}

Modified: sandbox/stm/branches/vbe/boost/synchro/lockable/try_lock.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/lockable/try_lock.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/lockable/try_lock.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -14,6 +14,8 @@
 #ifndef BOOST_SYNCHO_LOCKABLE_TRY_LOCK_HPP
 #define BOOST_SYNCHO_LOCKABLE_TRY_LOCK_HPP
 
+#include <assert.h>
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
@@ -21,7 +23,12 @@
 
     template< typename Lockable >
     inline bool try_lock(Lockable& lockable) {
+ try {
         return lockable.try_lock();
+ } catch (...) {
+ assert(false && "synchro::try_lock exception");
+ return false;
+ }
     }
 
 }}

Modified: sandbox/stm/branches/vbe/boost/synchro/lockable/unlock.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/lockable/unlock.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/lockable/unlock.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -14,6 +14,8 @@
 #ifndef BOOST_SYNCHO_LOCKABLE_UNLOCK_HPP
 #define BOOST_SYNCHO_LOCKABLE_UNLOCK_HPP
 
+#include <assert.h>
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 
@@ -21,7 +23,11 @@
 
     template< typename Lockable >
     inline void unlock(Lockable& lockable) {
+ try {
         lockable.unlock();
+ } catch (...) {
+ assert(false && "synchro::unlock exception");
+ }
     }
 
 }}

Added: sandbox/stm/branches/vbe/boost/synchro/lockers/var_lock_guard.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/lockers/var_lock_guard.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,70 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_SYNCHO_LOCKER_VAR_LOCK_GUARD_HPP
+#define BOOST_SYNCHO_LOCKER_VAR_LOCK_GUARD_HPP
+
+//-----------------------------------------------------------------------------
+#include <stdarg.h>
+//-----------------------------------------------------------------------------
+#include <list>
+//-----------------------------------------------------------------------------
+#include <boost/synchro/tags.hpp>
+#include <boost/synchro/exceptions.hpp>
+#include <boost/synchro/lockable/lock.hpp>
+#include <boost/synchro/lockable/unlock.hpp>
+//-----------------------------------------------------------------------------
+
+namespace boost { namespace synchro {
+
+ //-----------------------------------------------------------------------------
+ template <typename T>
+ class var_lock_guard {
+ public:
+
+ typedef T lock_type;
+ typedef std::list<lock_type*> list_type;
+
+ //--------------------------------------------------------------------------
+ var_lock_guard(lock_type *l, ...) {
+ va_list ap;
+ va_start(ap, l);
+ while (l) {
+ lockList_.push_back(l);
+ l = va_arg(ap, lock_type*);
+ }
+ va_end(ap);
+
+ for (typename list_type::iterator it = lockList_.begin();
+ it != lockList_.end(); ++it) {
+ synchro::lock(**it);
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ ~var_lock_guard() {
+ for (typename list_type::iterator it = lockList_.begin();
+ it != lockList_.end(); ++it) {
+ synchro::unlock(**it);
+ }
+ }
+
+ private:
+ list_type lockList_;
+
+ };
+
+}}
+#endif // BOOST_SYNCHO_LOCKER_VAR_LOCK_GUARD_HPP
+
+

Added: sandbox/stm/branches/vbe/boost/synchro/poly/adaptive_lock.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/poly/adaptive_lock.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,87 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_POLY_ADAPTIVE_LOCK__HPP
+#define BOOST_SYNCHRO_POLY_ADAPTIVE_LOCK__HPP
+
+#include <boost/synchro/poly/lock.hpp>
+
+namespace boost { namespace synchro { namespace poly {
+
+class adaptive_exclusive_lock
+ : public virtual exclusive_lock
+{
+public:
+ virtual ~adaptive_exclusive_lock() {}
+ virtual void lock()
+ {lock_->lock();}
+ virtual void unlock()
+ {lock_->unlock();}
+ virtual bool try_lock()
+ { return lock_->try_lock();}
+protected:
+ adaptive_exclusive_lock(exclusive_lock* lock) : lock_(lock)
+ {
+ // assert lock is not null
+ }
+ exclusive_lock* lock_;
+};
+#if 0
+
+class adaptive_sharable_lock
+ : public adaptive_exclusive_lock
+ , public virtual sharable_lock
+{
+public:
+ virtual ~adaptive_sharable_lock() {}
+ virtual void lock_shared()
+ {the_lock()->lock_shared();}
+ virtual bool try_lock_shared()
+ { return the_lock()->try_lock_shared();}
+ virtual void unlock_shared()
+ {the_lock()->unlock_shared();}
+protected:
+ adaptive_sharable_lock(sharable_lock* lock) : adaptive_exclusive_lock(lock)
+ {}
+
+private:
+ sharable_lock* the_lock() {return static_cast<sharable_lock*>(this->lock_);}
+};
+
+class adaptive_upgradable_lock
+ : public adaptive_sharable_lock
+ , public virtual upgradable_lock
+{
+public:
+ virtual ~adaptive_upgradable_lock() {}
+ virtual void lock_upgrade()
+ {the_lock()->lock_upgrade();}
+ virtual void unlock_upgrade()
+ {the_lock()->unlock_upgrade();}
+
+ virtual void unlock_upgrade_and_lock()
+ {the_lock()->unlock_upgrade_and_lock();}
+ virtual void unlock_and_lock_upgrade()
+ {the_lock()->unlock_and_lock_upgrade();}
+ virtual void unlock_and_lock_shared()
+ {the_lock()->unlock_and_lock_shared();}
+ virtual void unlock_upgrade_and_lock_shared()
+ {the_lock()->unlock_upgrade_and_lock_shared();}
+protected:
+ adaptive_upgradable_lock(upgradable_lock* lock)
+ : adaptive_sharable_lock(lock) {}
+private:
+ upgradable_lock* the_lock() {return static_cast<upgradable_lock*>(this->lock_);}
+};
+#endif
+}
+}
+}
+#endif

Added: sandbox/stm/branches/vbe/boost/synchro/poly/lock_adapter.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/poly/lock_adapter.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,190 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_POLY_LOCK_ADAPTER__HPP
+#define BOOST_SYNCHRO_POLY_LOCK_ADAPTER__HPP
+
+#include <boost/synchro/poly/lock.hpp>
+#include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/synchro/lockable.hpp>
+
+namespace boost { namespace synchro { namespace poly {
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename Lockable>
+class exclusive_lock_adapter
+ : public exclusive_lock
+{
+public:
+ typedef Lockable lockable_type;
+#if 0
+ typedef typename scope_tag<Lockable>::type scope;
+ typedef typename category_tag<Lockable>::type category;
+ typedef typename reentrancy_tag<Lockable>::type reentrancy;
+ typedef typename timed_interface_tag<Lockable>::type timed_interface;
+ typedef typename lifetime_tag<Lockable>::type lifetime;
+ typedef typename naming_tag<Lockable>::type naming;
+#endif
+ BOOST_COPY_CONSTRUCTOR_DELETE(exclusive_lock_adapter) /*< disable copy construction >*/
+ BOOST_COPY_ASSIGNEMENT_DELETE(exclusive_lock_adapter) /*< disable copy asignement >*/
+ exclusive_lock_adapter(): lock_() {}
+ ~exclusive_lock_adapter() {}
+
+ void lock() {synchro::lock(lock_);}
+ void unlock() {synchro::unlock(lock_);}
+ bool try_lock() { return synchro::try_lock(lock_);}
+protected:
+ Lockable lock_;
+};
+
+#if 0
+
+template <typename TimeLockable>
+class timed_lock_adapter
+ : public exclusive_lock_adapter<TimeLockable>
+ , public timed_lock
+{
+public:
+ ~timed_lock_adapter() {}
+ bool try_lock_until(chrono::system_clock::time_point const& abs_time)
+ {return the_lock().try_lock_until(abs_time);}
+ bool try_lock_for(chrono::nanoseconds const& rel_time)
+ {return try_lock_for(rel_time);}
+ void lock_until(chrono::system_clock::time_point const& abs_time)
+ {the_lock().lock_until(abs_time);}
+ void lock_for(chrono::nanoseconds const& rel_time)
+ {lock_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ void lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().lock_for(rel_time);}
+
+
+private:
+ TimeLockable& the_lock() {return *static_cast<TimeLockable*>(&this->lock_);}
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename SharableLock>
+class sharable_lock_adapter
+ : public timed_lock_adapter<SharableLock>
+ , public sharable_lock
+{
+public:
+ ~sharable_lock_adapter()
+ {}
+ void lock_shared()
+ {the_lock().lock_shared();}
+ bool try_lock_shared()
+ {return the_lock().try_lock_shared();}
+ void unlock_shared()
+ {the_lock().unlock_shared();}
+
+ bool try_lock_shared_until(chrono::system_clock::time_point const& t)
+ {return the_lock().try_lock_shared_until(t);}
+ bool try_lock_shared_for(chrono::nanoseconds const& t)
+ {return the_lock().try_lock_shared_for(t);}
+
+ void lock_shared_until(chrono::system_clock::time_point const& t)
+ {the_lock().lock_shared_until(t);}
+ void lock_shared_for(chrono::nanoseconds const& t)
+ {the_lock().lock_shared_for(t);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_shared_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_shared_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_shared_for(rel_time);}
+
+
+ template<typename Clock, typename Duration>
+ void lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_shared_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_shared_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().lock_shared_for(rel_time);}
+
+private:
+ SharableLock& the_lock() {return *static_cast<SharableLock*>(&this->lock_);}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename UpgradableLock>
+class upgradable_lock_adapter
+ : public sharable_lock_adapter<UpgradableLock>
+ , public upgradable_lock
+{
+public:
+ ~upgradable_lock_adapter() {}
+ void lock_upgrade()
+ {the_lock().lock_upgrade();}
+ void unlock_upgrade()
+ {the_lock().unlock_upgrade();}
+
+ void unlock_upgrade_and_lock()
+ {the_lock().unlock_upgrade_and_lock();}
+ void unlock_and_lock_upgrade()
+ {the_lock().unlock_and_lock_upgrade();}
+ void unlock_and_lock_shared()
+ {the_lock().unlock_and_lock_shared();}
+ void unlock_upgrade_and_lock_shared()
+ {the_lock().unlock_upgrade_and_lock_shared();}
+
+ bool try_lock_upgrade()
+ {return the_lock().try_lock_upgrade();}
+ bool try_lock_upgrade_until(chrono::system_clock::time_point const&t)
+ {return the_lock().try_lock_upgrade_until(t);}
+ bool try_lock_upgrade_for(chrono::nanoseconds const&t)
+ {return the_lock().try_lock_upgrade_for(t);}
+ void lock_upgrade_until(chrono::system_clock::time_point const&t)
+ {the_lock().lock_upgrade_until(t);}
+ void lock_upgrade_for(chrono::nanoseconds const&t)
+ {the_lock().lock_upgrade_for(t);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_upgrade_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_upgrade_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ void lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_upgrade_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().try_lock_upgrade_for(rel_time);}
+
+private:
+ UpgradableLock& the_lock() {return *static_cast<UpgradableLock*>(&this->lock_);}
+};
+
+#endif
+
+}
+}
+}
+
+#endif

Added: sandbox/stm/branches/vbe/boost/synchro/poly/ref_lock_adapter.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/synchro/poly/ref_lock_adapter.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -0,0 +1,196 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-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/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_SYNCHRO_POLY_REF_LOCK_ADAPTER__HPP
+#define BOOST_SYNCHRO_POLY_REF_LOCK_ADAPTER__HPP
+
+#include <boost/synchro/poly/lock.hpp>
+#include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/synchro/lockable.hpp>
+
+namespace boost { namespace synchro { namespace poly {
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename Lockable, typename Base=exclusive_lock>
+class exclusive_ref_lock_adapter
+ : public Base
+{
+public:
+ typedef Lockable lockable_type;
+#if 0
+ typedef typename scope_tag<Lockable>::type scope;
+ typedef typename category_tag<Lockable>::type category;
+ typedef typename reentrancy_tag<Lockable>::type reentrancy;
+ typedef typename timed_interface_tag<Lockable>::type timed_interface;
+ typedef typename lifetime_tag<Lockable>::type lifetime;
+ typedef typename naming_tag<Lockable>::type naming;
+#endif
+ BOOST_COPY_CONSTRUCTOR_DELETE(exclusive_ref_lock_adapter) /*< disable copy construction >*/
+ BOOST_COPY_ASSIGNEMENT_DELETE(exclusive_ref_lock_adapter) /*< disable copy asignement >*/
+ exclusive_ref_lock_adapter(lockable_type& lock): lock_(lock) {}
+ ~exclusive_ref_lock_adapter() {}
+
+ void lock() {synchro::lock(lock_);}
+ void unlock() {synchro::unlock(lock_);}
+ bool try_lock() { return synchro::try_lock(lock_);}
+protected:
+ Lockable& lock_;
+};
+
+#if 0
+
+template <typename TimeLockable, typename Base=timed_lock>
+class timed_ref_lock_adapter
+ : public exclusive_ref_lock_adapter<TimeLockable, Base>
+{
+ typedef TimeLockable lockable_type;
+ typedef exclusive_ref_lock_adapter<TimeLockable, Base> base_type;
+public:
+ timed_ref_lock_adapter(lockable_type& lock) : base_type(lock) {}
+ ~timed_ref_lock_adapter() {}
+ bool try_lock_until(chrono::system_clock::time_point const& abs_time)
+ {return the_lock().try_lock_until(abs_time);}
+ bool try_lock_for(chrono::nanoseconds const& rel_time)
+ {return try_lock_for(rel_time);}
+ void lock_until(chrono::system_clock::time_point const& abs_time)
+ {the_lock().lock_until(abs_time);}
+ void lock_for(chrono::nanoseconds const& rel_time)
+ {lock_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ void lock_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().lock_for(rel_time);}
+
+
+private:
+ TimeLockable& the_lock() {return *static_cast<TimeLockable*>(&this->lock_);}
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename SharableLock, typename Base=sharable_lock>
+class sharable_ref_lock_adapter
+ : public timed_ref_lock_adapter<SharableLock, Base>
+{
+ typedef SharableLock lockable_type;
+ typedef timed_ref_lock_adapter<lockable_type, Base> base_type;
+public:
+ sharable_ref_lock_adapter(lockable_type& lock) : base_type(lock) {}
+ ~sharable_ref_lock_adapter()
+ {}
+ void lock_shared()
+ {the_lock().lock_shared();}
+ bool try_lock_shared()
+ {return the_lock().try_lock_shared();}
+ void unlock_shared()
+ {the_lock().unlock_shared();}
+
+ bool try_lock_shared_until(chrono::system_clock::time_point const& t)
+ {return the_lock().try_lock_shared_until(t);}
+ bool try_lock_shared_for(chrono::nanoseconds const& t)
+ {return the_lock().try_lock_shared_for(t);}
+
+ void lock_shared_until(chrono::system_clock::time_point const& t)
+ {the_lock().lock_shared_until(t);}
+ void lock_shared_for(chrono::nanoseconds const& t)
+ {the_lock().lock_shared_for(t);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_shared_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_shared_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_shared_for(rel_time);}
+
+
+ template<typename Clock, typename Duration>
+ void lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_shared_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_shared_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().lock_shared_for(rel_time);}
+
+private:
+ SharableLock& the_lock() {return *static_cast<SharableLock*>(&this->lock_);}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+template <typename UpgradableLock, typename Base=upgradable_lock>
+class upgradable_ref_lock_adapter
+ : public sharable_ref_lock_adapter<UpgradableLock, Base>
+{
+ typedef UpgradableLock lockable_type;
+ typedef sharable_ref_lock_adapter<lockable_type, Base> base_type;
+public:
+ sharable_ref_lock_adapter(lockable_type& lock) : base_type(lock) {}
+ ~upgradable_ref_lock_adapter() {}
+ void lock_upgrade()
+ {the_lock().lock_upgrade();}
+ void unlock_upgrade()
+ {the_lock().unlock_upgrade();}
+
+ void unlock_upgrade_and_lock()
+ {the_lock().unlock_upgrade_and_lock();}
+ void unlock_and_lock_upgrade()
+ {the_lock().unlock_and_lock_upgrade();}
+ void unlock_and_lock_shared()
+ {the_lock().unlock_and_lock_shared();}
+ void unlock_upgrade_and_lock_shared()
+ {the_lock().unlock_upgrade_and_lock_shared();}
+
+ bool try_lock_upgrade()
+ {return the_lock().try_lock_upgrade();}
+ bool try_lock_upgrade_until(chrono::system_clock::time_point const&t)
+ {return the_lock().try_lock_upgrade_until(t);}
+ bool try_lock_upgrade_for(chrono::nanoseconds const&t)
+ {return the_lock().try_lock_upgrade_for(t);}
+ void lock_upgrade_until(chrono::system_clock::time_point const&t)
+ {the_lock().lock_upgrade_until(t);}
+ void lock_upgrade_for(chrono::nanoseconds const&t)
+ {the_lock().lock_upgrade_for(t);}
+
+ template<typename Clock, typename Duration>
+ bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {return the_lock().try_lock_upgrade_until(abs_time);}
+ template<typename Rep, typename Period>
+ bool try_lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
+ {return the_lock().try_lock_upgrade_for(rel_time);}
+
+ template<typename Clock, typename Duration>
+ void lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
+ {the_lock().lock_upgrade_until(abs_time);}
+ template<typename Rep, typename Period>
+ void lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
+ {the_lock().try_lock_upgrade_for(rel_time);}
+
+private:
+ UpgradableLock& the_lock() {return *static_cast<UpgradableLock*>(&this->lock_);}
+};
+
+#endif
+
+}
+}
+}
+
+#endif

Modified: sandbox/stm/branches/vbe/boost/synchro/pthread/mutex.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/synchro/pthread/mutex.hpp (original)
+++ sandbox/stm/branches/vbe/boost/synchro/pthread/mutex.hpp 2009-11-04 06:09:15 EST (Wed, 04 Nov 2009)
@@ -42,14 +42,14 @@
     template<>
     inline void lock<pthread_mutex_t>(pthread_mutex_t& lockable) {
         int const res = pthread_mutex_lock(&lockable);
- BOOST_STM_VERIFY(res==0);
+ BOOST_STM_VERIFY(res==0&&"synchro::lock<pthread_mutex_t>");
         //if (res!=0) throw lock_error();
     }
 
     template<>
     inline void unlock<pthread_mutex_t>(pthread_mutex_t& lockable) {
         int const res= pthread_mutex_unlock(&lockable);
- BOOST_STM_VERIFY(res==0);
+ BOOST_STM_VERIFY(res==0&&"synchro::unlock<pthread_mutex_t>");
         //if (res!=0) throw lock_error();
     }
 


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