Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56993 - in sandbox/stm/branches/vbe: boost/stm boost/stm/detail boost/stm/memory_managers boost/stm/non_tx/detail libs/stm/src libs/stm/test
From: vicente.botet_at_[hidden]
Date: 2009-10-19 08:30:07


Author: viboes
Date: 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
New Revision: 56993
URL: http://svn.boost.org/trac/boost/changeset/56993

Log:
TBoost.STM vbe: Preparation to use boost:thread::id instead of size_t
* define thread_id_t, version_t, priority_t, clock_t, milliseconds_t, new_memory_t types in datatypes.hpp
* define this_thread::get_id() and invalid_thread_id() in datatypes.hpp
* Replace size_t by std::size_t, thread_id_t, version_t, priority_t, clock_t, milliseconds_t, new_memory_t
* replace THREAD_ID by this_thread::get_id() and remove THREAD_ID macro
* replace kInvalidThread by invalid_thread_id()
* move move specific to move.hpp file
* move latm_type and transaction_type types to datatypes.hpp
* replace in transaction_bookkeeping uint32 by std::size_t, thread_id_t or clock_t.
* move SLEEP from detail/datatypes.hpp to datatypes.hpp

Text files modified:
   sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp | 27 +++---
   sandbox/stm/branches/vbe/boost/stm/contention_manager.hpp | 4
   sandbox/stm/branches/vbe/boost/stm/datatypes.hpp | 144 ++++++++++++++++++++++++++++-------
   sandbox/stm/branches/vbe/boost/stm/detail/auto_lock.hpp | 47 +++++++----
   sandbox/stm/branches/vbe/boost/stm/detail/bit_vector.hpp | 29 +++---
   sandbox/stm/branches/vbe/boost/stm/detail/config.hpp | 10 ++
   sandbox/stm/branches/vbe/boost/stm/detail/datatypes.hpp | 31 -------
   sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp | 51 ++++++++++--
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_full_impl.hpp | 8 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tm_impl.hpp | 8 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_def_tx_impl.hpp | 10 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_full_impl.hpp | 8 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tm_impl.hpp | 8 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_dir_tx_impl.hpp | 12 +-
   sandbox/stm/branches/vbe/boost/stm/detail/latm_general_impl.hpp | 10 +-
   sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp | 42 +++++-----
   sandbox/stm/branches/vbe/boost/stm/memory_managers/base_memory_manager.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/memory_managers/memory_manage.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/move.hpp | 13 ++-
   sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/shallow_transaction_object.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 157 ++++++++++++++++-----------------------
   sandbox/stm/branches/vbe/boost/stm/transaction_bookkeeping.hpp | 133 +++++++++++++++++----------------
   sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/transactional_object.hpp | 6
   sandbox/stm/branches/vbe/libs/stm/src/contention_manager.cpp | 4
   sandbox/stm/branches/vbe/libs/stm/src/except_and_back_off_on_abort_notice_cm.cpp | 4
   sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp | 14 +-
   sandbox/stm/branches/vbe/libs/stm/test/stm.cpp | 2
   29 files changed, 450 insertions(+), 362 deletions(-)

Modified: sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -58,7 +58,7 @@
 public:
 
     base_transaction_object()
- : transactionThread_(kInvalidThread)
+ : transactionThread_(invalid_thread_id())
         , newMemory_(0)
 #if PERFORMING_VALIDATION
         , version_(0)
@@ -70,7 +70,7 @@
 
 #if 1
     base_transaction_object(const base_transaction_object &t)
- : transactionThread_(kInvalidThread)
+ : transactionThread_(invalid_thread_id())
         , newMemory_(0)
 #if PERFORMING_VALIDATION
         , version_(0)
@@ -91,14 +91,14 @@
     virtual ~base_transaction_object() {};
     virtual void cache_deallocate()=0;
 
- void transaction_thread(size_t rhs) const { transactionThread_ = rhs; }
- size_t const & transaction_thread() const { return transactionThread_; }
+ void transaction_thread(thread_id_t rhs) const { transactionThread_ = rhs; }
+ thread_id_t const & transaction_thread() const { return transactionThread_; }
 
- void new_memory(size_t rhs) const { newMemory_ = rhs; }
- size_t const & new_memory() const { return newMemory_; }
+ void new_memory(new_memory_t rhs) const { newMemory_ = rhs; }
+ new_memory_t const & new_memory() const { return newMemory_; }
 
 #if PERFORMING_VALIDATION
- size_t version_;
+ version_t version_;
 #endif
 
 #if BOOST_STM_ALLOWS_EMBEDEEDS
@@ -107,20 +107,20 @@
 #endif
 
 #if USE_STM_MEMORY_MANAGER
- static void alloc_size(size_t size) { memory_.alloc_size(size); }
+ static void alloc_size(std::size_t size) { memory_.alloc_size(size); }
 #else
- static void alloc_size(size_t size) { }
+ static void alloc_size(std::size_t size) { }
 #endif
 //protected:
 
 #if USE_STM_MEMORY_MANAGER
- static void return_mem(void *mem, size_t size)
+ static void return_mem(void *mem, std::size_t size)
     {
         synchro::lock_guard<Mutex> lock(transactionObjectMutex_);
         memory_.returnChunk(mem, size);
     }
 
- static void* retrieve_mem(size_t size)
+ static void* retrieve_mem(std::size_t size)
     {
         synchro::lock_guard<Mutex> lock(transactionObjectMutex_);
         void *mem = memory_.retrieveChunk(size);
@@ -144,9 +144,8 @@
     // and deferred reads and writes behave very differently when using this
     // flag.
     //--------------------------------------------------------------------------
- mutable size_t transactionThread_;
-
- mutable size_t newMemory_;
+ mutable thread_id_t transactionThread_;
+ mutable new_memory_t newMemory_;
 #if USE_STM_MEMORY_MANAGER
     static Mutex transactionObjectMutex_;
     static MemoryPool<base_transaction_object> memory_;

Modified: sandbox/stm/branches/vbe/boost/stm/contention_manager.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/contention_manager.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/contention_manager.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -232,9 +232,9 @@
       if (txTryingToAbortIsIrrevocable) return true;
 
 #ifndef DISABLE_READ_SETS
- if ((size_t)lockWaitTime > rhs.read_set_size() + 100 * rhs.writes())
+ if ((clock_t)lockWaitTime > rhs.read_set_size() + 100 * rhs.writes())
 #else
- if ((size_t)lockWaitTime > 100 * rhs.writes())
+ if ((clock_t)lockWaitTime > 100 * rhs.writes())
 #endif
       {
          return true;

Modified: sandbox/stm/branches/vbe/boost/stm/datatypes.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/datatypes.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/datatypes.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -15,45 +15,127 @@
 #define BOOST_STM_DATATYPES__HPP
 
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
+#include <cstddef>
 //-----------------------------------------------------------------------------
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
 
 
 //-----------------------------------------------------------------------------
 namespace boost { namespace stm {
 
-//-----------------------------------------------------------------------------
-// The possible states a transaction can be in:
-//
-// e_no_state - initial state of transaction.
-// e_aborted - aborted transaction.
-// e_committed - transaction has committed.
-// e_hand_off - transaction memory has been handed off to another
-// transaction. This is the vital state for in-flight
-// transactions which are composed.
-// e_in_flight - transaction currently in process.
-//-----------------------------------------------------------------------------
-enum transaction_state
-{
- e_no_state = -1, // no state is -1
- e_aborted, // ensure aborted = 0
- e_committed, // committed is positive
- e_hand_off, // so is handoff in case bool conversion
- e_in_flight
-};
-
-
-unsigned const kInvalidThread = 0xffffffff;
-
-
-
-} // namespace core
-}
+ //-----------------------------------------------------------------------------
+ // The possible states a transaction can be in:
+ //
+ // e_no_state - initial state of transaction.
+ // e_aborted - aborted transaction.
+ // e_committed - transaction has committed.
+ // e_hand_off - transaction memory has been handed off to another
+ // transaction. This is the vital state for in-flight
+ // transactions which are composed.
+ // e_in_flight - transaction currently in process.
+ //-----------------------------------------------------------------------------
+ enum transaction_state
+ {
+ e_no_state = -1, // no state is -1
+ e_aborted, // ensure aborted = 0
+ e_committed, // committed is positive
+ e_hand_off, // so is handoff in case bool conversion
+ e_in_flight
+ };
+
+ //-----------------------------------------------------------------------------
+ enum transaction_type
+ {
+ kMinIrrevocableType = 0,
+ eNormalTx = kMinIrrevocableType,
+ eIrrevocableTx,
+ eIrrevocableAndIsolatedTx,
+ kMaxIrrevocableType
+ };
+ typedef transaction_type TxType;
+
+ //-----------------------------------------------------------------------------
+ enum latm_type
+ {
+ kMinLatmType = 0,
+ eFullLatmProtection = kMinLatmType,
+ eTmConflictingLockLatmProtection,
+ eTxConflictingLockLatmProtection,
+ kMaxLatmType
+ };
+ typedef latm_type LatmType;
+
+//-----------------------------------------------------------------------------
+
+ typedef std::size_t new_memory_t;
+
+//-----------------------------------------------------------------------------
+
+ typedef std::size_t priority_t;
+
+//-----------------------------------------------------------------------------
+
+ typedef std::size_t clock_t;
+ typedef std::size_t milliseconds_t;
+
+//-----------------------------------------------------------------------------
+
+ typedef std::size_t version_t;
+
+//-----------------------------------------------------------------------------
+
+#ifndef BOOST_STM_USE_BOOST_THREAD_ID
+ typedef std::size_t thread_id_t;
+ namespace detail {
+ thread_id_t const kInvalidThread = 0xffffffff;
+ }
+ inline thread_id_t invalid_thread_id() {
+ return detail::kInvalidThread;
+ }
+ inline bool is_invalid_thread_id(thread_id_t t) {
+ return detail::kInvalidThread==t;
+ }
+ namespace this_thread {
+ inline thread_id_t get_id() {
+#ifdef WINOS
+#pragma warning (disable:4786)
+ return (thread_id_t)pthread_self().p;
+#else // !WINOS
+ return (thread_id_t)pthread_self();
+#endif // WINOS
+ }
+ }
+#else // BOOST_STM_USE_BOOST_THREAD_ID
+ typedef boost::thread::id thread_id_t;
+ thread_id_t const kInvalidThread;
+ inline thread_id_t invalid_thread_id() {
+ return thread_id_t();
+ }
+
+ inline bool is_invalid_thread_id(thread_id_t t) {
+ return thread_id_t()==t;
+ }
+ namespace this_thread {
+ inline thread_id_t get_id() {
+ return boost::this_thread::get_id();
+ }
+ }
+#endif // BOOST_STM_USE_BOOST_THREAD_ID
+
+
+#ifndef BOOST_STM_USE_BOOST_SLEEP
+#ifdef WINOS
+#define SLEEP(x) Sleep(x)
+#else
+#include <unistd.h>
+#define SLEEP(x) usleep(x*1000)
+#endif
+#else
+#define SLEEP(x) boost::this_thread::sleep(boost::posix_time::milliseconds(x))
+#endif
+
+}}
 #endif // BOOST_STM_DATATYPES__HPP
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/detail/auto_lock.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/auto_lock.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/auto_lock.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -14,16 +14,27 @@
 #ifndef BOOST_STM_AUTO_LOCK_H
 #define BOOST_STM_AUTO_LOCK_H
 
+//---------------------------------------------------------------------------
 #include <pthread.h>
 #include <stdexcept>
+//---------------------------------------------------------------------------
 #include <string>
 #include <iostream>
 #include <map>
 #include <vector>
-#include <boost/stm/detail/datatypes.hpp>
-
+//---------------------------------------------------------------------------
+#include <boost/stm/detail/config.hpp>
+//---------------------------------------------------------------------------
+#include <boost/stm/datatypes.hpp>
 #ifdef PERFORMING_LATM
 #include <boost/stm/transaction.hpp>
+#else
+#endif
+//---------------------------------------------------------------------------
+
+
+//---------------------------------------------------------------------------
+#ifdef PERFORMING_LATM
 #define BOOST_STM_LOCK(a) boost::stm::transaction::lock_(a)
 #define BOOST_STM_UNLOCK(a) boost::stm::transaction::unlock_(a)
 #else
@@ -32,11 +43,10 @@
 #endif
 
 //---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
 namespace boost { namespace stm {
 
 
-//-----------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 class timer_lock_exception : public std::exception
 {
@@ -52,11 +62,13 @@
 
 typedef timer_lock_exception timer_err;
 
+//---------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 class auto_lock
 {
 public:
- typedef std::pair<size_t const, Mutex*> ThreadedLockPair;
- typedef std::multimap<size_t const, Mutex*> ThreadedLockContainer;
+ typedef std::pair<thread_id_t const, Mutex*> ThreadedLockPair;
+ typedef std::multimap<thread_id_t const, Mutex*> ThreadedLockContainer;
    typedef ThreadedLockContainer::iterator ThreadedLockIter;
 
    auto_lock(Mutex &mutex) : hasLock_(false), lock_(0)
@@ -70,12 +82,12 @@
    }
 
 
- auto_lock(size_t timeOut, Mutex &mutex) : hasLock_(false), lock_(0)
+ auto_lock(milliseconds_t timeOut, Mutex &mutex) : hasLock_(false), lock_(0)
    {
       do_timed_auto_lock(timeOut, &mutex);
    }
 
- auto_lock(size_t timeOut, Mutex *mutex) : hasLock_(false), lock_(0)
+ auto_lock(milliseconds_t timeOut, Mutex *mutex) : hasLock_(false), lock_(0)
    {
       do_timed_auto_lock(timeOut, mutex);
    }
@@ -94,13 +106,13 @@
 
 private:
 
- void do_timed_auto_lock(size_t timeOut, Mutex *mutex)
+ void do_timed_auto_lock(milliseconds_t timeOut, Mutex *mutex)
    {
       lock_ = mutex;
 
       if (thread_has_lock(mutex)) return;
 
- for (size_t i = 0; i < timeOut; ++i)
+ for (milliseconds_t i = 0; i < timeOut; ++i)
       {
          if (synchro::try_lock(*lock_))
          {
@@ -118,7 +130,7 @@
    void insert_into_threaded_lock_map(Mutex* mutex)
    {
       synchro::lock_guard<Mutex> lock_i(*global_lock());
- threaded_locks().insert(ThreadedLockPair(THREAD_ID, mutex));
+ threaded_locks().insert(ThreadedLockPair(this_thread::get_id(), mutex));
    }
 
    void do_auto_lock(Mutex *mutex)
@@ -149,7 +161,7 @@
       for (ThreadedLockIter i = threaded_locks().begin();
       i != threaded_locks().end(); ++i)
       {
- if (i->first == THREAD_ID && i->second == rhs)
+ if (i->first == this_thread::get_id() && i->second == rhs)
          {
             return true;
          }
@@ -165,7 +177,7 @@
       for (ThreadedLockIter i = threaded_locks().begin();
       i != threaded_locks().end(); ++i)
       {
- if (i->first == THREAD_ID && i->second == rhs)
+ if (i->first == this_thread::get_id() && i->second == rhs)
          {
             threaded_locks().erase(i);
             break;
@@ -196,6 +208,8 @@
    Mutex *lock_;
 };
 
+//---------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 #define use_lock(L) if (bool __end=false); else \
     for (boost::stm::auto_lock ___l(L); !__end; __end=true)
 #define use_timed_lock(T, L) if (bool __end=false); else \
@@ -206,12 +220,9 @@
 #define catch_lock_timeout(E) } catch (std::timer_lock_exception &E)
 #define lock_timeout } catch (std::timer_lock_exception &E)
 
-} // core namespace
-}
-
-
+}}
 
-#endif // AUTO_LOCK_H
+#endif // BOOST_STM_AUTO_LOCK_H
 
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/detail/bit_vector.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/bit_vector.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/bit_vector.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -16,6 +16,7 @@
 
 #include <string.h>
 #include <math.h>
+#include <cstddef>
 
 //#define def_bit_vector_size 4194304
 
@@ -36,12 +37,12 @@
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 namespace boost { namespace stm {
- typedef size_t chunk_type;
- size_t const chunk_size = sizeof(chunk_type);
- size_t const byte_size = 8;
- size_t const chunk_bits = chunk_size * byte_size;
- size_t const chunk_shift = 5;
- size_t const chunk_shift_bits = (int)pow((double)2.0, (double)chunk_shift) - 1;
+ typedef std::size_t chunk_type;
+ std::size_t const chunk_size = sizeof(chunk_type);
+ std::size_t const byte_size = 8;
+ std::size_t const chunk_bits = chunk_size * byte_size;
+ std::size_t const chunk_shift = 5;
+ std::size_t const chunk_shift_bits = (int)pow((double)2.0, (double)chunk_shift) - 1;
 
 
 //---------------------------------------------------------------------------
@@ -59,7 +60,7 @@
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- size_t operator[](size_t const rhs) const
+ std::size_t operator[](std::size_t const rhs) const
    {
       //---------------------------------------------------------------------
       // (1) select the correct chunk from the bits_ array.
@@ -84,38 +85,38 @@
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- size_t const size() const { return def_bit_vector_size; }
+ std::size_t const size() const { return def_bit_vector_size; }
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- size_t const alloc_size() const { return def_bit_vector_alloc_size; }
+ std::size_t const alloc_size() const { return def_bit_vector_alloc_size; }
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- void set(size_t rhs)
+ void set(std::size_t rhs)
    {
       bits_[(rhs >> chunk_shift)] |= 1 << (rhs & chunk_shift_bits);
    }
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- void reset(size_t rhs)
+ void reset(std::size_t rhs)
    {
       bits_[(rhs >> chunk_shift)] &= 0 << (rhs & chunk_shift_bits);
    }
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- bool test(size_t rhs)
+ bool test(std::size_t rhs)
    {
       return ( bits_[(rhs >> chunk_shift)] & (1 << (rhs & chunk_shift_bits)) ) > 0 ? true : false;
    }
 
    //------------------------------------------------------------------------
    //------------------------------------------------------------------------
- size_t intersects(bit_vector const & rhs) const
+ std::size_t intersects(bit_vector const & rhs) const
    {
- for (register size_t i = 0; i < def_bit_vector_alloc_size; ++i)
+ for (register std::size_t i = 0; i < def_bit_vector_alloc_size; ++i)
       {
          if (bits_[i] & rhs.bits_[i]) return 1;
       }

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -14,6 +14,14 @@
 #ifndef BOOST_STM_DETAIL_CONFIG_H
 #define BOOST_STM_DETAIL_CONFIG_H
 
+#ifdef WIN32
+#define WINOS
+#elif WIN64
+#define WINOS
+#else
+#define UNIX
+#endif
+
 //#define DELAY_INVALIDATION_DOOMED_TXS_UNTIL_COMMIT
 //#define LOGGING_COMMITS_AND_ABORTS 1
 //#define PERFORMING_VALIDATION 1
@@ -33,7 +41,7 @@
 // BOOST_STM_HAVE_SINGLE_TSS_CONTEXT_MAP: use of common tss_context as TSS
 // OTHER: each TSS data has its specific TSS
 
-#define USE_SINGLE_THREAD_CONTEXT_MAP 1
+//#define USE_SINGLE_THREAD_CONTEXT_MAP 1
 //#define BOOST_STM_HAVE_SINGLE_TSS_CONTEXT_MAP 1
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/detail/datatypes.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/datatypes.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/datatypes.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -15,40 +15,11 @@
 #define BOOST_STM_dataTypes_header_file
 
 /////////////////////////////////////////////////////////////////////////////
-#ifdef WIN32
-#define WINOS
-#elif WIN64
-#define WINOS
-#else
-#define UNIX
-#endif
 
 #include <stdlib.h>
 #include <pthread.h>
 
-#ifndef BOOST_STM_USE_BOOST_THREAD_ID
-#ifdef WINOS
-#pragma warning (disable:4786)
-#define THREAD_ID (size_t)pthread_self().p
-#else
-#define THREAD_ID (size_t) pthread_self()
-#endif
-#else
-
-#define THREAD_ID boost::this_thread::get_id()
-#endif
-
-
-#ifndef BOOST_STM_USE_BOOST_SLEEP
-#ifdef WINOS
-#define SLEEP(x) Sleep(x)
-#else
-#include <unistd.h>
-#define SLEEP(x) usleep(x*1000)
-#endif
-#else
-#define SLEEP(x) boost::this_thread::sleep(boost::posix_time::milliseconds(x))
-#endif
+
 
 /////////////////////////////////////////////////////////////////////////////
 // types

Modified: sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -20,29 +20,35 @@
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
 #include <boost/stm/base_transaction.hpp>
+#include <boost/stm/datatypes.hpp>
 //-----------------------------------------------------------------------------
-#include <boost/stm/detail/datatypes.hpp>
 
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
 namespace boost { namespace stm { namespace detail {
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 struct deleter {
     virtual void reset()=0;
     virtual void release()=0;
 };
 
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 template <typename T>
 struct base_transaction_object_deleter : deleter {
     T* ptr_;
     base_transaction_object_deleter(T* ptr) : ptr_(ptr) {}
     virtual void reset() {
- static_cast<base_transaction_object*>(ptr_)->transaction_thread(kInvalidThread);
+ static_cast<base_transaction_object*>(ptr_)->transaction_thread(invalid_thread_id());
     };
     virtual void release() {
         delete ptr_;
     };
 };
 
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 template <typename T>
 struct base_transaction_object_array_deleter : deleter {
     T* ptr_;
@@ -50,7 +56,7 @@
     base_transaction_object_array_deleter (T* ptr, std::size_t size) : ptr_(ptr), size_(size) {}
     virtual void reset() {
         for (std::size_t i =0; i< size_; ++i) {
- static_cast<base_transaction_object*>(ptr_+i)->transaction_thread(kInvalidThread);
+ static_cast<base_transaction_object*>(ptr_+i)->transaction_thread(invalid_thread_id());
             static_cast<base_transaction_object*>(ptr_+i)->new_memory(0);
         }
     };
@@ -59,6 +65,8 @@
     };
 };
 
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
 template <typename T>
 struct non_transaction_object_deleter : deleter {
     T* ptr_;
@@ -69,7 +77,7 @@
     virtual void reset() {
         binds_type& binds= ptr_->binds();
         for (binds_iterator it =binds.begin(); it!= binds.end(); ++it) {
- static_cast<base_transaction_object*>(*it)->transaction_thread(kInvalidThread);
+ static_cast<base_transaction_object*>(*it)->transaction_thread(invalid_thread_id());
             static_cast<base_transaction_object*>(*it)->new_memory(0);
         }
     };
@@ -78,7 +86,9 @@
     };
 };
 
+//-----------------------------------------------------------------------------
 // For array of non transactional object types
+//-----------------------------------------------------------------------------
 
 template <typename T>
 struct non_transaction_object_array_deleter : deleter {
@@ -92,7 +102,7 @@
         for (std::size_t i =0; i< size_; ++i) {
             binds_type& binds= (ptr_+i)->binds();
             for (binds_iterator it =binds.begin(); it!= binds.end(); ++it) {
- static_cast<base_transaction_object*>(*it)->transaction_thread(kInvalidThread);
+ static_cast<base_transaction_object*>(*it)->transaction_thread(invalid_thread_id());
                 static_cast<base_transaction_object*>(*it)->new_memory(0);
             }
         }
@@ -104,15 +114,25 @@
 
 
 #ifndef BOOST_STM_ALLOWS_DELETERS
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     typedef base_transaction_object deleter_type;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline void reset(deleter_type* ptr) {
- ptr->transaction_thread(kInvalidThread);
+ ptr->transaction_thread(invalid_thread_id());
         ptr->new_memory(0);
     }
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline void release(deleter_type* ptr) {
         delete ptr;
     }
     
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline deleter_type* make(base_transaction_object* p) {
         return p;
     }
@@ -126,6 +146,8 @@
         return const_cast<deleter_type*>(&r);
     }
 
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline deleter_type* make_array(base_transaction_object* p, std::size_t size) {
         return p;
     }
@@ -140,16 +162,27 @@
     }
     
 #else
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     typedef detail::deleter deleter_type;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline void reset(deleter_type* ptr) {
         ptr->reset();
         delete ptr;
     }
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     inline void release(deleter_type* ptr) {
         ptr->release();
         delete ptr;
     }
     
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     template <typename T>
     inline deleter_type* make(T* p) {
         return new base_transaction_object_deleter<T>(p);
@@ -167,6 +200,8 @@
         return new base_transaction_object_deleter<T>(const_cast<T*>(&r));
     }
     
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
     template <typename T>
     inline deleter_type* make_array(T* p, std::size_t size) {
         return new base_transaction_object_array_deleter<T>(p, size);
@@ -186,7 +221,7 @@
     
 #endif
 }}}
-///////////////////////////////////////////////////////////////////////////////
+
 #endif // BOOST_STM_DETAIL_DELETERS__HPP
 
 

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -117,7 +117,7 @@
       t->commit_deferred_update_tx();
        { synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
        }
 
@@ -164,7 +164,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
    return 0;
 }
@@ -185,7 +185,7 @@
       t->commit_deferred_update_tx();
        { synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
        }
 
@@ -219,7 +219,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ 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

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -111,7 +111,7 @@
       {
           synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
       }
 
@@ -161,7 +161,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    return 0;
@@ -184,7 +184,7 @@
       {
       synchro::lock_guard<Mutex> lock_l(*latm_lock());
       //synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       //synchro::unlock(*latm_lock());
       }
 
@@ -221,7 +221,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ 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

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -54,7 +54,7 @@
    synchro::lock_guard<Mutex> autolock_i(*inflight_lock());
 
    std::list<transaction *> txList;
- std::set<size_t> txThreadId;
+ std::set<thread_id_t> txThreadId;
 
    for (InflightTxes::iterator i = transactionsInFlight_.begin();
       i != transactionsInFlight_.end(); ++i)
@@ -62,7 +62,7 @@
       transaction *t = (transaction*)*i;
 
       // if this tx is part of this thread, skip it (it's an LiT)
- if (t->threadId_ == THREAD_ID) continue;
+ if (t->threadId_ == this_thread::get_id()) continue;
 
       // if this mutex has a conflict with an inflight tx
       if (t->get_tx_conflicting_locks().find(mutex) != t->get_tx_conflicting_locks().end())
@@ -98,7 +98,7 @@
       }
       catch (...)
       {
- for (std::set<size_t>::iterator it = txThreadId.begin();
+ for (std::set<thread_id_t>::iterator it = txThreadId.begin();
          txThreadId.end() != it; ++it)
          {
             if (0 == thread_id_occurance_in_locked_locks_map(*it))
@@ -200,7 +200,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
@@ -253,7 +253,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -133,7 +133,7 @@
 
       // this method locks LATM and keeps it locked upon returning if param true
       wait_until_all_locks_are_released(true);
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
 
       if (hadLock) return 0;
@@ -179,7 +179,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
    return 0;
 }
@@ -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] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
 
       if (hadLock) return 0;
@@ -234,7 +234,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ 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

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -124,7 +124,7 @@
       transaction::must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
       synchro::lock(*mutex);
       return 0;
@@ -166,7 +166,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    return 0;
@@ -182,7 +182,7 @@
       transaction::must_be_in_tm_conflicting_lock_set(mutex);
       t->make_isolated();
       synchro::lock(*latm_lock());
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       synchro::unlock(*latm_lock());
       return synchro::try_lock(*mutex)?0:1;
    }
@@ -212,7 +212,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ 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

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -55,7 +55,7 @@
    synchro::lock(*inflight_lock());
 
    std::list<transaction *> txList;
- std::set<size_t> txThreadId;
+ std::set<thread_id_t> txThreadId;
    //transaction *txToMakeIsolated = 0;
 
    for (InflightTxes::iterator i = transactionsInFlight_.begin();
@@ -64,7 +64,7 @@
       transaction *t = (transaction*)*i;
 
       // if this tx is part of this thread, skip it (it's an LiT)
- if (t->threadId_ == THREAD_ID) continue;
+ if (t->threadId_ == this_thread::get_id()) continue;
 
       if (t->get_tx_conflicting_locks().find(mutex) != t->get_tx_conflicting_locks().end())
       {
@@ -97,11 +97,11 @@
       {
          latmLockedLocksAndThreadIdsMap_.insert
          (std::make_pair<Mutex*, ThreadIdSet>(mutex, txThreadId));
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
       }
       catch (...)
       {
- for (std::set<size_t>::iterator it = txThreadId.begin();
+ for (std::set<thread_id_t>::iterator it = txThreadId.begin();
          txThreadId.end() != it; ++it)
          {
             if (0 == thread_id_occurance_in_locked_locks_map(*it))
@@ -234,7 +234,7 @@
       ++aborted;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents
@@ -285,7 +285,7 @@
       throw;
    }
 
- latmLockedLocksOfThreadMap_[mutex] = THREAD_ID;
+ latmLockedLocksOfThreadMap_[mutex] = this_thread::get_id();
    synchro::unlock(latmMutex_);
 
    // note: we do not release the transactionsInFlightMutex - this will prevents

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -468,21 +468,21 @@
       MutexThreadMap::iterator l = latmLockedLocksOfThreadMap_.find(*k);
 
       if (l != latmLockedLocksOfThreadMap_.end() &&
- THREAD_ID != l->second)
+ this_thread::get_id() != l->second)
       {
          MutexThreadSetMap::iterator locksAndThreadsIter = latmLockedLocksAndThreadIdsMap_.find(*k);
 
          if (locksAndThreadsIter == latmLockedLocksAndThreadIdsMap_.end())
          {
             ThreadIdSet s;
- s.insert(THREAD_ID);
+ s.insert(this_thread::get_id());
 
             latmLockedLocksAndThreadIdsMap_.insert
             (std::make_pair<Mutex*, ThreadIdSet>(*k, s));
          }
          else
          {
- locksAndThreadsIter->second.insert(THREAD_ID);
+ locksAndThreadsIter->second.insert(this_thread::get_id());
          }
 
          this->block(); break;
@@ -497,7 +497,7 @@
 //
 //----------------------------------------------------------------------------
 inline int boost::stm::transaction::
-thread_id_occurance_in_locked_locks_map(size_t threadId)
+thread_id_occurance_in_locked_locks_map(thread_id_t threadId)
 {
    int count = 0;
 
@@ -529,7 +529,7 @@
       // txs, then this lock is INSIDE this tx - don't abort the tx, just
       // make it isolated and ensure it is performing direct updating
       //--------------------------------------------------------------------
- if (t->thread_id() == THREAD_ID)
+ if (t->thread_id() == this_thread::get_id())
       {
          //if (!hasTxInFlightMutex) synchro::unlock(*inflight_lock());
          return t;

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -299,7 +299,7 @@
 
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
-inline void transaction::lock_all_mutexes_but_this(size_t threadId)
+inline void transaction::lock_all_mutexes_but_this(thread_id_t threadId)
 {
 #ifdef BOOST_STM_HAVE_SINGLE_TSS_CONTEXT_MAP
     for (tss_context_map_type::iterator i = tss_context_map_.begin();
@@ -319,7 +319,7 @@
 }
 
 //--------------------------------------------------------------------------
-inline void transaction::unlock_all_mutexes_but_this(size_t threadId)
+inline void transaction::unlock_all_mutexes_but_this(thread_id_t threadId)
 {
 #ifdef BOOST_STM_HAVE_SINGLE_TSS_CONTEXT_MAP
     for (tss_context_map_type::iterator i = tss_context_map_.begin();
@@ -394,7 +394,7 @@
 //
 //--------------------------------------------------------------------------
 inline transaction::transaction() :
- threadId_(THREAD_ID),
+ threadId_(this_thread::get_id()),
    //transactionMutexLocker_(),
    auto_general_lock_(*general_lock()),
 
@@ -622,13 +622,13 @@
 {
    // 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 THREAD_ID
+ // is obtained is on this_thread::get_id()
    if (transaction::doing_full_lock_protection())
    {
       for (MutexThreadMap::iterator j = latmLockedLocksOfThreadMap_.begin();
       j != latmLockedLocksOfThreadMap_.end(); ++j)
       {
- if (THREAD_ID != j->second)
+ if (this_thread::get_id() != j->second)
          {
             return false;
          }
@@ -648,7 +648,7 @@
             MutexThreadMap::iterator j = latmLockedLocksOfThreadMap_.find(*i);
 
             if (j != latmLockedLocksOfThreadMap_.end() &&
- THREAD_ID != j->second)
+ this_thread::get_id() != j->second)
             {
                return false;
             }
@@ -1065,7 +1065,7 @@
    // unlock this - we only needed it to check abort_before_commit()
    synchro::unlock(*inflight_lock());
 
- uint32 ms = clock();
+ clock_t ms = clock();
 
    //--------------------------------------------------------------------------
    // as much as I'd like to transactionsInFlight_.erase() here, we have
@@ -1199,7 +1199,7 @@
          // if t's modifiedList is modifying memory we are also modifying, make t bail
          ///////////////////////////////////////////////////////////////////
 #ifdef USE_BLOOM_FILTER
- if (t->bloom().exists((size_t)i->first))
+ if (t->bloom().exists((std::size_t)i->first))
 #else
          if (t->writeList().end() != t->writeList().find(i->first))
 #endif
@@ -1464,7 +1464,7 @@
          while (!forceOtherInFlightTransactionsAccessingThisWriteMemoryToAbort(wait, stallingOn))
          {
             ++stalling_;
- size_t local_clock = global_clock();
+ clock_t local_clock = global_clock();
 
             synchro::unlock(*inflight_lock());
             synchro::unlock(*general_lock());
@@ -1804,7 +1804,7 @@
       // memory is being destroyed, not updated. Do not perform copy_state()
       // on it.
       //
- // However, deleted memory MUST reset its kInvalidThread
+ // However, deleted memory MUST reset its invalid_thread_id()
       // transaction_thread (which is performed in void directAbortTransactionDeletedMemory() throw();
 
       //-----------------------------------------------------------------------
@@ -1812,7 +1812,7 @@
 
       if (using_move_semantics()) i->first->move_state(i->second);
       else i->first->copy_state(i->second);
- i->first->transaction_thread(kInvalidThread);
+ i->first->transaction_thread(invalid_thread_id());
 
       cache_release(i->second);
    }
@@ -1845,11 +1845,11 @@
 }
 
 //----------------------------------------------------------------------------
-inline size_t transaction::earliest_start_time_of_inflight_txes()
+inline clock_t transaction::earliest_start_time_of_inflight_txes()
 {
    synchro::lock_guard<Mutex> a(*inflight_lock());
 
- size_t secs = 0xffffffff;
+ clock_t secs = 0xffffffff;
 
    for (InflightTxes::iterator j = transactionsInFlight_.begin();
    j != transactionsInFlight_.end(); ++j)
@@ -1870,7 +1870,7 @@
 {
    using namespace boost::stm;
 
- size_t earliestInFlightTx = earliest_start_time_of_inflight_txes();
+ clock_t earliestInFlightTx = earliest_start_time_of_inflight_txes();
 
    synchro::lock_guard<Mutex> a(deletionBufferMutex_);
 
@@ -1901,7 +1901,7 @@
    if (!deletedMemoryList().empty())
    {
       synchro::lock_guard<Mutex> a(deletionBufferMutex_);
- deletionBuffer_.insert( std::pair<size_t, MemoryContainerList>
+ deletionBuffer_.insert( std::pair<clock_t, MemoryContainerList>
          (time(0), deletedMemoryList()) );
       deletedMemoryList().clear();
    }
@@ -1938,7 +1938,7 @@
    for (MemoryContainerList::iterator i = newMemoryList().begin(); i != newMemoryList().end(); ++i)
    {
       detail::reset(*i);
- //(*i)->transaction_thread(kInvalidThread);
+ //(*i)->transaction_thread(invalid_thread_id());
       //(*i)->new_memory(0);
    }
 
@@ -1959,7 +1959,7 @@
       // memory is being destroyed, not updated. Do not perform copyState()
       // on it.
       //-----------------------------------------------------------------------
- i->first->transaction_thread(kInvalidThread);
+ i->first->transaction_thread(invalid_thread_id());
       i->first->new_memory(0);
 
       //-----------------------------------------------------------------------
@@ -1994,7 +1994,7 @@
       if (using_move_semantics()) i->first->move_state(i->second);
       else i->first->copy_state(i->second);
 
- i->first->transaction_thread(kInvalidThread);
+ i->first->transaction_thread(invalid_thread_id());
       i->first->new_memory(0);
 
 #if PERFORMING_VALIDATION
@@ -2121,7 +2121,7 @@
             //////////////////////////////////////////////////////////////////////
             // if t's readList is reading memory we are modifying, make t bail
             //////////////////////////////////////////////////////////////////////
- if (t->bloom().exists((size_t)i->first))
+ if (t->bloom().exists((std::size_t)i->first))
             {
                if (allow_stall && t->is_only_reading())// && t->reads() > work)
                {
@@ -2131,7 +2131,7 @@
                }
                // if the conflict is not a write-write conflict, stall
 #if 0
- if (allow_stall && !t->wbloom().exists((size_t)i->first))
+ if (allow_stall && !t->wbloom().exists((std::size_t)i->first))
                {
                   ++stalls_;
                   stallingOn = t;
@@ -2245,7 +2245,7 @@
          // if t's readList is reading memory we are modifying, make t bail
          //////////////////////////////////////////////////////////////////////
 #ifdef USE_BLOOM_FILTER
- if (t->bloom().exists((size_t)i->first))
+ if (t->bloom().exists((std::size_t)i->first))
 #else
          if (t->readList().end() != t->readList().find(i->first))
 #endif

Modified: sandbox/stm/branches/vbe/boost/stm/memory_managers/base_memory_manager.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/memory_managers/base_memory_manager.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/memory_managers/base_memory_manager.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -46,15 +46,15 @@
 {
     base_memory_manager();
 public:
- static void alloc_size(size_t size) { memory_.alloc_size(size); }
+ static void alloc_size(std::size_t size) { memory_.alloc_size(size); }
 
- static void return_mem(void *mem, size_t size)
+ static void return_mem(void *mem, std::size_t size)
     {
         synchro::lock_guard<Mutex> lock(transactionObjectMutex_);
         memory_.returnChunk(mem, size);
     }
 
- static void* retrieve_mem(size_t size)
+ static void* retrieve_mem(std::size_t size)
     {
         synchro::lock_guard<Mutex> lock(transactionObjectMutex_);
         void *mem = memory_.retrieveChunk(size);

Modified: sandbox/stm/branches/vbe/boost/stm/memory_managers/memory_manage.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/memory_managers/memory_manage.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/memory_managers/memory_manage.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -50,11 +50,11 @@
 public:
     typedef memory_manager<Derived, Base> this_type;
 
- void* operator new(size_t size, const nothrow_t&) throw () {
+ void* operator new(std::size_t size, const nothrow_t&) throw () {
         return base_memory_manager::retrieve_mem(size);
     }
     
- void* operator new(size_t size) throw (std::bad_alloc) {
+ void* operator new(std::size_t size) throw (std::bad_alloc) {
         void* ptr= base_memory_manager::retrieve_mem(size);
         if (ptr==0) throw std::bad_alloc;
         return ptr;
@@ -62,7 +62,7 @@
 
     void operator delete(void* mem) throw () {
         static Derived elem;
- static size_t elemSize = sizeof(elem);
+ static std::size_t elemSize = sizeof(elem);
         base_memory_manager::return_mem(mem, elemSize);
    }
 };

Modified: sandbox/stm/branches/vbe/boost/stm/move.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/move.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/move.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -15,18 +15,23 @@
 #define BOOST_STM_MOVE__HPP
 
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
+#if BUILD_MOVE_SEMANTICS
+#include <type_traits>
+#endif
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
 namespace boost { namespace stm {
 
 #if BUILD_MOVE_SEMANTICS
+bool const kDracoMoveSemanticsCompiled = true;
+#else
+bool const kDracoMoveSemanticsCompiled = false;
+#endif
+
+#if BUILD_MOVE_SEMANTICS
 template <class T>
 inline typename std::remove_reference<T>::type&& draco_move(T &&t)
 {

Modified: sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -99,11 +99,11 @@
     }
 
 #if USE_STM_MEMORY_MANAGER
- void* operator new(size_t size, const std::nothrow_t&) throw ()
+ void* operator new(std::size_t size, const std::nothrow_t&) throw ()
    {
       return retrieve_mem(size);
    }
- void* operator new(size_t size) throw (std::bad_alloc)
+ void* operator new(std::size_t size) throw (std::bad_alloc)
     {
         void* ptr= retrieve_mem(size);
         if (ptr==0) throw std::bad_alloc;
@@ -113,7 +113,7 @@
    void operator delete(void* mem) throw ()
    {
       static cache<T> elem;
- static size_t elemSize = sizeof(elem);
+ static std::size_t elemSize = sizeof(elem);
       return_mem(mem, elemSize);
    }
 #endif

Modified: sandbox/stm/branches/vbe/boost/stm/shallow_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/shallow_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/shallow_transaction_object.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -87,11 +87,11 @@
 
 
 #if USE_STM_MEMORY_MANAGER
- void* operator new(size_t size, const std::nothrow_t&) throw ()
+ void* operator new(std::size_t size, const std::nothrow_t&) throw ()
    {
       return retrieve_mem(size);
    }
- void* operator new(size_t size) throw (std::bad_alloc)
+ void* operator new(std::size_t size) throw (std::bad_alloc)
     {
         void* ptr= retrieve_mem(size);
         if (ptr==0) throw std::bad_alloc;
@@ -101,7 +101,7 @@
    void operator delete(void* mem) throw ()
    {
       static Derived elem;
- static size_t elemSize = sizeof(elem);
+ static std::size_t elemSize = sizeof(elem);
       return_mem(mem, elemSize);
    }
 #endif

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -29,20 +29,19 @@
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
 #include <boost/stm/base_transaction.hpp>
+#include <boost/stm/datatypes.hpp>
+#include <boost/stm/move.hpp>
 #include <boost/stm/transaction_bookkeeping.hpp>
+
 #include <boost/synchro/tss.hpp>
 //-----------------------------------------------------------------------------
-#include <boost/stm/detail/datatypes.hpp>
-#include <boost/stm/detail/deleters.hpp>
 #include <boost/stm/detail/bloom_filter.hpp>
-#include <boost/stm/detail/vector_map.hpp>
-#include <boost/stm/detail/vector_set.hpp>
+#include <boost/stm/detail/deleters.hpp>
 #include <boost/stm/detail/monotonic_storage.hpp>
 #include <boost/stm/detail/transactions_stack.hpp>
+#include <boost/stm/detail/vector_map.hpp>
+#include <boost/stm/detail/vector_set.hpp>
 
-#if BUILD_MOVE_SEMANTICS
-#include <type_traits>
-#endif
 
 #if defined(BOOST_STM_CM_STATIC_CONF)
 #if defined(BOOST_STM_CM_STATIC_CONF_except_and_back_off_on_abort_notice_cm)
@@ -60,11 +59,6 @@
 //-----------------------------------------------------------------------------
 namespace boost { namespace stm {
 
-#if BUILD_MOVE_SEMANTICS
-bool const kDracoMoveSemanticsCompiled = true;
-#else
-bool const kDracoMoveSemanticsCompiled = false;
-#endif
 
 //-----------------------------------------------------------------------------
 // boolean which is used to invoke "begin_transaction()" upon transaction
@@ -80,24 +74,6 @@
 #endif
 #endif
 
-enum latm_type
-{
- kMinLatmType = 0,
- eFullLatmProtection = kMinLatmType,
- eTmConflictingLockLatmProtection,
- eTxConflictingLockLatmProtection,
- kMaxLatmType
-};
-typedef latm_type LatmType;
-enum transaction_type
-{
- kMinIrrevocableType = 0,
- eNormalTx = kMinIrrevocableType,
- eIrrevocableTx,
- eIrrevocableAndIsolatedTx,
- kMaxIrrevocableType
-};
-typedef transaction_type TxType;
 
 typedef std::pair<base_transaction_object*, base_transaction_object*> tx_pair;
 
@@ -113,11 +89,11 @@
    //--------------------------------------------------------------------------
 
 #if PERFORMING_VALIDATION
- typedef std::map<base_transaction_object*, size_t> ReadContainer;
+ typedef std::map<base_transaction_object*, version_t> ReadContainer;
 #else
    typedef std::set<base_transaction_object*> ReadContainer;
 #endif
- typedef std::map<size_t, ReadContainer*> ThreadReadContainer;
+ typedef std::map<thread_id_t, ReadContainer*> ThreadReadContainer;
 
 #ifdef MAP_WRITE_CONTAINER
    typedef std::map<base_transaction_object*, base_transaction_object*> WriteContainer;
@@ -135,43 +111,43 @@
        TransactionsStack transactions_;
    };
 
- typedef std::map<size_t, WriteContainer*> ThreadWriteContainer;
- typedef std::map<size_t, TxType*> ThreadTxTypeContainer;
+ typedef std::map<thread_id_t, WriteContainer*> ThreadWriteContainer;
+ typedef std::map<thread_id_t, TxType*> ThreadTxTypeContainer;
 
    typedef std::set<transaction*> TContainer;
    typedef std::set<transaction*> InflightTxes;
 
- typedef std::multimap<size_t, MemoryContainerList > DeletionBuffer;
+ typedef std::multimap<clock_t, MemoryContainerList > DeletionBuffer;
 
    typedef std::set<Mutex*> MutexSet;
 
- typedef std::set<size_t> ThreadIdSet;
+ typedef std::set<thread_id_t> ThreadIdSet;
 
- typedef std::map<size_t, MemoryContainerList*> ThreadMemoryContainerList;
+ typedef std::map<thread_id_t, MemoryContainerList*> ThreadMemoryContainerList;
 
- typedef std::pair<size_t, Mutex*> thread_mutex_pair;
+ typedef std::pair<thread_id_t, Mutex*> thread_mutex_pair;
     #ifndef MAP_THREAD_MUTEX_CONTAINER
- typedef vector_map<size_t, Mutex*> ThreadMutexContainer;
+ typedef vector_map<thread_id_t, Mutex*> ThreadMutexContainer;
     #else
- typedef std::map<size_t, Mutex*> ThreadMutexContainer;
+ typedef std::map<thread_id_t, Mutex*> ThreadMutexContainer;
     #endif
 
- typedef std::map<size_t, MutexSet* > ThreadMutexSetContainer;
- typedef std::map<size_t, bloom_filter*> ThreadBloomFilterList;
+ typedef std::map<thread_id_t, MutexSet* > ThreadMutexSetContainer;
+ typedef std::map<thread_id_t, bloom_filter*> ThreadBloomFilterList;
     #ifdef BOOST_STM_BLOOM_FILTER_USE_DYNAMIC_BITSET
- typedef std::map<size_t, boost::dynamic_bitset<>*> ThreadBitVectorList;
+ typedef std::map<thread_id_t, boost::dynamic_bitset<>*> ThreadBitVectorList;
     #else
- typedef std::map<size_t, bit_vector*> ThreadBitVectorList;
+ typedef std::map<thread_id_t, bit_vector*> ThreadBitVectorList;
     #endif
- typedef std::pair<size_t, int*> thread_bool_pair;
+ typedef std::pair<thread_id_t, int*> thread_bool_pair;
     #ifndef MAP_THREAD_BOOL_CONTAINER
- typedef vector_map<size_t, int*> ThreadBoolContainer;
+ typedef vector_map<thread_id_t, int*> ThreadBoolContainer;
     #else
- typedef std::map<size_t, int*> ThreadBoolContainer;
+ typedef std::map<thread_id_t, int*> ThreadBoolContainer;
     #endif
 
    typedef std::map<Mutex*, ThreadIdSet > MutexThreadSetMap;
- typedef std::map<Mutex*, size_t> MutexThreadMap;
+ typedef std::map<Mutex*, thread_id_t> MutexThreadMap;
 
    typedef std::set<transaction*> LockedTransactionContainer;
 
@@ -239,9 +215,9 @@
     #endif
 
     #ifndef BOOST_STM_HAVE_SINGLE_TSS_CONTEXT_MAP
- typedef std::map<size_t, tx_context*> tss_context_map_type;
+ typedef std::map<thread_id_t, tx_context*> tss_context_map_type;
     #else
- typedef std::map<size_t, tss_context*> tss_context_map_type;
+ typedef std::map<thread_id_t, tss_context*> tss_context_map_type;
     #endif
     #endif
 
@@ -558,7 +534,7 @@
       // our write set
       //-----------------------------------------------------------------------
       if (1 == in.new_memory()) return in;
- if (in.transaction_thread() == kInvalidThread) return in;
+ if (in.transaction_thread() == invalid_thread_id()) return in;
 
       base_transaction_object *inPtr = (base_transaction_object*)&in;
 
@@ -592,12 +568,12 @@
    //
    //--------------------------------------------------------------------------
     #ifndef DISABLE_READ_SETS
- inline size_t const read_set_size() const { return readListRef_.size(); }
+ inline std::size_t const read_set_size() const { return readListRef_.size(); }
     #endif
 
- inline size_t const writes() const { return write_list()->size(); }
+ inline std::size_t const writes() const { return write_list()->size(); }
    inline bool written() const {return !write_list()->empty();}
- inline size_t const reads() const { return reads_; }
+ inline std::size_t const reads() const { return reads_; }
 
    template <typename T> T const * read_ptr(T const * in)
    {
@@ -639,7 +615,7 @@
         //----------------------------------------------------------------
         return i != readList().end();
         #else
- return bloom().exists((size_t)&in);
+ return bloom().exists((std::size_t)&in);
         #endif
     }
 
@@ -831,13 +807,13 @@
    //--------------------------------------------------------------------------
    void lock_and_abort();
 
- inline size_t writeListSize() const { return write_list()->size(); }
+ inline std::size_t writeListSize() const { return write_list()->size(); }
 
- inline size_t const &priority() const { return priority_; }
- inline void set_priority(uint32 const &rhs) const { priority_ = rhs; }
+ inline priority_t const &priority() const { return priority_; }
+ inline void set_priority(priority_t const &rhs) const { priority_ = rhs; }
    inline void raise_priority()
    {
- if (priority_ < size_t(-1))
+ if (priority_ < priority_t(-1))
       {
          ++priority_;
       }
@@ -850,8 +826,7 @@
    bool irrevocable() const;
    bool isolated() const;
 
- typedef size_t thread_id_t;
- inline size_t const & thread_id() const { return threadId_; }
+ inline thread_id_t const & thread_id() const { return threadId_; }
 
 private:
 
@@ -922,7 +897,7 @@
          synchro::lock_guard<Mutex> lock(*mutex());
 
 
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
          {
             synchro::lock_guard<Mutex> guard(mutex(in.transaction_thread()));
             //Mutex& m=mutex(in.transaction_thread());
@@ -939,7 +914,7 @@
             readList().insert((base_transaction_object*)readMem->second);
 #endif
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)readMem->second);
+ bloom().insert((std::size_t)readMem->second);
 #endif
             //unlock_tx();
 
@@ -952,7 +927,7 @@
          readList().insert((base_transaction_object*)&in);
 #endif
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
 #endif
          //unlock_tx();
          ++reads_;
@@ -964,7 +939,7 @@
          // if we want direct write-read conflict to be done early, bail
          // if someone owns this
          //--------------------------------------------------------------------
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
          {
             // let the contention manager decide to throw or not
             cm_abort_on_write(*this, (base_transaction_object&)(in));
@@ -977,7 +952,7 @@
          readList().insert((base_transaction_object*)&in);
 #endif
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
 #endif
          //unlock_tx();
          ++reads_;
@@ -1008,7 +983,7 @@
 
       // we currently don't allow write stealing in direct update. if another
       // tx beat us to the memory, we abort
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
       {
          //unlock(&transactionMutex_);
          throw aborted_tx("direct writer already exists.");
@@ -1017,7 +992,7 @@
       in.transaction_thread(threadId_);
       writeList().insert(tx_pair((base_transaction_object*)&in, in.clone(this)));
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
 #endif
       //unlock(&transactionMutex_);
       return in;
@@ -1041,7 +1016,7 @@
       //lock(&transactionMutex_);
       synchro::unique_lock<Mutex> lock_m(transactionMutex_);
 
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
       {
          //unlock(&transactionMutex_);
          cm_abort_on_write(*this, (base_transaction_object&)(in));
@@ -1078,7 +1053,7 @@
       //lock(&transactionMutex_);
       synchro::unique_lock<Mutex> lock_m(transactionMutex_);
 
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
       {
          //unlock(&transactionMutex_);
          cm_abort_on_write(*this, (base_transaction_object&)(in));
@@ -1117,7 +1092,7 @@
 #if PERFORMING_WRITE_BLOOM
       if (writeList().empty() ||
          (writeList().size() > 16 &&
- !wbloom().exists((size_t)&in))) return insert_and_return_read_memory(in);
+ !wbloom().exists((std::size_t)&in))) return insert_and_return_read_memory(in);
 #else
       if (writeList().empty()) return insert_and_return_read_memory(in);
 #endif
@@ -1145,7 +1120,7 @@
       //----------------------------------------------------------------
       if (i != readList().end()) return in;
 #else
- if (bloom().exists((size_t)&in)) return in;
+ if (bloom().exists((std::size_t)&in)) return in;
 #endif
       synchro::lock_guard<Mutex> lock(*mutex());
       //lock_tx();
@@ -1157,7 +1132,7 @@
 #endif
 #endif
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
 #endif
       //unlock_tx();
       ++reads_;
@@ -1177,7 +1152,7 @@
       // if transactionThread_ is not invalid, then already writing to
       // non-global memory - so succeed.
       //----------------------------------------------------------------
- if (in.transaction_thread() != kInvalidThread) return in;
+ if (in.transaction_thread() != invalid_thread_id()) return in;
 
       WriteContainer::iterator i = writeList().find
          (static_cast<base_transaction_object*>(&in));
@@ -1190,7 +1165,7 @@
          //lock_tx();
          synchro::unique_lock<Mutex> lock(*mutex());
 #if USE_BLOOM_FILTER
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
          //unlock_tx();
          lock.unlock();
 #else
@@ -1227,11 +1202,11 @@
       // if this memory is true memory, not transactional, we add it to our
       // deleted list and we're done
       //-----------------------------------------------------------------------
- if (in.transaction_thread() != kInvalidThread)
+ if (in.transaction_thread() != invalid_thread_id())
       {
          { synchro::lock_guard<Mutex> lock(*mutex());
          //lock_tx();
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
          //unlock_tx();
          }
          writeList().insert(tx_pair((base_transaction_object*)&in, 0));
@@ -1245,7 +1220,7 @@
       {
          { synchro::lock_guard<Mutex> lock(*mutex());
          //lock_tx();
- bloom().insert((size_t)&in);
+ bloom().insert((std::size_t)&in);
          //unlock_tx();
          }
          // check the ENTIRE write container for this piece of memory in the
@@ -1279,8 +1254,8 @@
    void invalidating_direct_commit();
 
    //--------------------------------------------------------------------------
- static void lock_all_mutexes_but_this(size_t threadId);
- static void unlock_all_mutexes_but_this(size_t threadId);
+ static void lock_all_mutexes_but_this(thread_id_t threadId);
+ static void unlock_all_mutexes_but_this(thread_id_t threadId);
 
    //--------------------------------------------------------------------------
    // side-effect: this unlocks all mutexes including its own. this is a slight
@@ -1321,7 +1296,7 @@
    // direct and deferred transaction method for version / memory management
    //--------------------------------------------------------------------------
    void directCommitTransactionDeletedMemory() throw();
- size_t earliest_start_time_of_inflight_txes();
+ clock_t earliest_start_time_of_inflight_txes();
    void doIntervalDeletions();
 
    void deferredCommitTransactionDeletedMemory() throw();
@@ -1390,7 +1365,7 @@
    static bool dir_do_core_full_pthread_lock_mutex
       (Mutex *mutex, int lockWaitTime, int lockAborted);
 
- static int thread_id_occurance_in_locked_locks_map(size_t threadId);
+ static int thread_id_occurance_in_locked_locks_map(thread_id_t threadId);
 
    static void wait_until_all_locks_are_released(bool);
 
@@ -1480,8 +1455,8 @@
 
    //--------------------------------------------------------------------------
    static bool direct_updating_;
- static size_t global_clock_;
- inline static size_t& global_clock() {return global_clock_;}
+ static clock_t global_clock_;
+ inline static clock_t& global_clock() {return global_clock_;}
 
    static size_t stalls_;
 
@@ -1503,7 +1478,7 @@
    // INITIALIZATION IS ORDER DEPENDENT UPON threadId_!!
    // ******** WARNING ******** MOVING threadId_ WILL BREAK TRANSACTION
    //--------------------------------------------------------------------------
- size_t threadId_;
+ thread_id_t threadId_;
 
    synchro::unique_lock<Mutex> auto_general_lock_;
 
@@ -1649,7 +1624,7 @@
         threadObtainedLocks_.end() != i; ++i)
         {
             // if these are locks obtained by this thread (in a parent tx), don't block
- if (i->first == THREAD_ID) continue;
+ if (i->first == this_thread::get_id()) continue;
 
             for (MutexSet::iterator j = i->second->begin(); j != i->second->end(); ++j)
             {
@@ -1804,7 +1779,7 @@
         tss_context_map_.end() != i; ++i)
         {
             // if these are locks obtained by this thread (in a parent tx), don't block
- if (i->first == THREAD_ID) continue;
+ if (i->first == this_thread::get_id()) continue;
 
             for (MutexSet::iterator j = i->second->obtainedLocks_.begin(); j != i->second->obtainedLocks_.end(); ++j)
             {
@@ -1943,7 +1918,7 @@
         threadObtainedLocks_.end() != i; ++i)
         {
             // if these are locks obtained by this thread (in a parent tx), don't block
- if (i->first == THREAD_ID) continue;
+ if (i->first == this_thread::get_id()) continue;
 
             for (MutexSet::iterator j = i->second->begin(); j != i->second->end(); ++j)
             {
@@ -1979,10 +1954,10 @@
 
    // transaction specific data
    //int hasMutex_; // bool - 1 bit
- mutable size_t priority_;
+ mutable priority_t priority_;
    transaction_state state_; // 2bits
- size_t reads_;
- mutable size_t startTime_;
+ std::size_t reads_;
+ mutable clock_t startTime_;
 
    inline transaction_state const & state() const { return state_; }
 

Modified: sandbox/stm/branches/vbe/boost/stm/transaction_bookkeeping.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction_bookkeeping.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction_bookkeeping.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -17,8 +17,9 @@
 #include <iostream>
 #include <vector>
 #include <map>
+#include <cstddef>
 #include <pthread.h>
-#include <boost/stm/detail/datatypes.hpp>
+#include <boost/stm/datatypes.hpp>
 
 namespace boost { namespace stm {
 
@@ -27,11 +28,11 @@
 {
 public:
 
- ThreadIdAndCommitId(uint32 const &threadId, uint32 const &commitId) :
+ ThreadIdAndCommitId(thread_id_t threadId, std::size_t const &commitId) :
       threadId_(threadId), commitId_(commitId) {}
 
- uint32 threadId_;
- uint32 commitId_;
+ thread_id_t threadId_;
+ std::size_t commitId_;
 
    bool operator==(ThreadIdAndCommitId const &rhs) const
    { return threadId_ == rhs.threadId_ && commitId_ == rhs.commitId_; }
@@ -52,9 +53,9 @@
 {
 public:
 
- typedef std::map<uint32, uint32> thread_commit_map;
- typedef std::map<ThreadIdAndCommitId, uint32> CommitHistory;
- typedef std::map<ThreadIdAndCommitId, uint32> AbortHistory;
+ typedef std::map<thread_id_t, std::size_t> thread_commit_map;
+ typedef std::map<ThreadIdAndCommitId, std::size_t> CommitHistory;
+ typedef std::map<ThreadIdAndCommitId, std::size_t> AbortHistory;
 
    transaction_bookkeeping() : aborts_(0), writeAborts_(0), readAborts_(0),
       abortPermDenied_(0), commits_(0), handOffs_(0), newMemoryCommits_(0),
@@ -64,38 +65,38 @@
       //abortTrackingMutex_ = PTHREAD_MUTEX_INITIALIZER;
    }
 
- uint32 const & lockConvoyMs() const { return lockConvoyMs_; }
- uint32 const & commitTimeMs() const { return commitTimeMs_; }
- uint32 const & readAborts() const { return readAborts_; }
- uint32 const & writeAborts() const { return writeAborts_; }
- uint32 const & abortPermDenied() const { return abortPermDenied_; }
- uint32 const totalAborts() const { return readAborts_ + writeAborts_ + abortPermDenied_; }
- uint32 const & commits() const { return commits_; }
- uint32 const & handOffs() const { return handOffs_; }
- uint32 const & newMemoryAborts() const { return newMemoryAborts_; }
- uint32 const & newMemoryCommits() const { return newMemoryCommits_; }
- uint32 const & deletedMemoryAborts() const { return deletedMemoryAborts_; }
- uint32 const & deletedMemoryCommits() const { return deletedMemoryCommits_; }
- uint32 const & readChangedToWrite() const { return readChangedToWrite_; }
- uint32 const & readStayedAsRead() const { return readStayedAsRead_; }
+ clock_t const & lockConvoyMs() const { return lockConvoyMs_; }
+ clock_t const & commitTimeMs() const { return commitTimeMs_; }
+ std::size_t const & readAborts() const { return readAborts_; }
+ std::size_t const & writeAborts() const { return writeAborts_; }
+ std::size_t const & abortPermDenied() const { return abortPermDenied_; }
+ std::size_t const totalAborts() const { return readAborts_ + writeAborts_ + abortPermDenied_; }
+ std::size_t const & commits() const { return commits_; }
+ std::size_t const & handOffs() const { return handOffs_; }
+ std::size_t const & newMemoryAborts() const { return newMemoryAborts_; }
+ std::size_t const & newMemoryCommits() const { return newMemoryCommits_; }
+ std::size_t const & deletedMemoryAborts() const { return deletedMemoryAborts_; }
+ std::size_t const & deletedMemoryCommits() const { return deletedMemoryCommits_; }
+ std::size_t const & readChangedToWrite() const { return readChangedToWrite_; }
+ std::size_t const & readStayedAsRead() const { return readStayedAsRead_; }
 
    void inc_read_aborts() { ++readAborts_; }
    void inc_write_aborts() { ++writeAborts_; }
 
- void inc_thread_commits(uint32 threadId)
+ void inc_thread_commits(thread_id_t threadId)
    {
 #if 0
- std::map<uint32, uint32>::iterator i = threadedCommits_.find(threadId);
+ std::map<thread_id_t, std::size_t>::iterator i = threadedCommits_.find(threadId);
 
       if (threadedCommits_.end() == i) threadedCommits_[threadId] = 1;
       else i->second = i->second + 1;
 #endif
    }
 
- void inc_thread_aborts(uint32 threadId)
+ void inc_thread_aborts(thread_id_t threadId)
    {
 #if 0
- std::map<uint32, uint32>::iterator i = threadedAborts_.find(threadId);
+ std::map<thread_id_t, std::size_t>::iterator i = threadedAborts_.find(threadId);
 
       if (threadedAborts_.end() == i)
       {
@@ -111,15 +112,15 @@
    thread_commit_map const & threadedCommits() const { return threadedCommits_; }
    thread_commit_map const & threadedAborts() const { return threadedAborts_; }
 
- void inc_lock_convoy_ms(uint32 const &rhs) { lockConvoyMs_ += rhs; }
- void inc_commit_time_ms(uint32 const &rhs) { commitTimeMs_ += rhs; }
- void inc_commits() { ++commits_; inc_thread_commits(THREAD_ID); }
- void inc_abort_perm_denied(uint32 const &threadId) { ++abortPermDenied_; inc_thread_aborts(threadId); }
+ void inc_lock_convoy_ms(clock_t const &rhs) { lockConvoyMs_ += rhs; }
+ void inc_commit_time_ms(clock_t const &rhs) { commitTimeMs_ += rhs; }
+ void inc_commits() { ++commits_; inc_thread_commits(this_thread::get_id()); }
+ void inc_abort_perm_denied(thread_id_t const &threadId) { ++abortPermDenied_; inc_thread_aborts(threadId); }
    void inc_handoffs() { ++handOffs_; }
- void inc_new_mem_aborts_by(uint32 const &rhs) { newMemoryAborts_ += rhs; }
- void inc_new_mem_commits_by(uint32 const &rhs) { newMemoryCommits_ += rhs; }
- void inc_del_mem_aborts_by(uint32 const &rhs) { deletedMemoryAborts_ += rhs; }
- void inc_del_mem_commits_by(uint32 const &rhs) { deletedMemoryCommits_ += rhs; }
+ void inc_new_mem_aborts_by(std::size_t const &rhs) { newMemoryAborts_ += rhs; }
+ void inc_new_mem_commits_by(std::size_t const &rhs) { newMemoryCommits_ += rhs; }
+ void inc_del_mem_aborts_by(std::size_t const &rhs) { deletedMemoryAborts_ += rhs; }
+ void inc_del_mem_commits_by(std::size_t const &rhs) { deletedMemoryCommits_ += rhs; }
    void incrementReadChangedToWrite() { ++readChangedToWrite_; }
    void incrementReadStayedAsRead() { ++readStayedAsRead_; }
 
@@ -128,59 +129,59 @@
    AbortHistory const& getAbortReadSetList() const { return abortedReadSetSize_; }
    AbortHistory const& getAbortWriteSetList() const { return abortedWriteSetSize_; }
 
- void pushBackSizeOfReadSetWhenAborting(uint32 const &size)
+ void pushBackSizeOfReadSetWhenAborting(std::size_t const &size)
    {
       //lock(&abortTrackingMutex_);
 
- ThreadIdAndCommitId tcId(THREAD_ID, ++aborts_);
+ ThreadIdAndCommitId tcId(this_thread::get_id(), ++aborts_);
 
       // if waiting for commit read from thread is already true, it means there
       // was no commit on the last abort, so drop it from the map
 
- if (waitingForCommitReadFromThread[THREAD_ID])
+ if (waitingForCommitReadFromThread[this_thread::get_id()])
       {
- abortedReadSetSize_.erase(ThreadIdAndCommitId(THREAD_ID, aborts_-1));
- abortedWriteSetSize_.erase(ThreadIdAndCommitId(THREAD_ID, aborts_-1));
+ abortedReadSetSize_.erase(ThreadIdAndCommitId(this_thread::get_id(), aborts_-1));
+ abortedWriteSetSize_.erase(ThreadIdAndCommitId(this_thread::get_id(), aborts_-1));
       }
 
       abortedReadSetSize_[tcId] = size;
- waitingForCommitReadFromThread[THREAD_ID] = true;
+ waitingForCommitReadFromThread[this_thread::get_id()] = true;
       //unlock(&abortTrackingMutex_);
    }
 
- void pushBackSizeOfWriteSetWhenAborting(uint32 const &size)
+ void pushBackSizeOfWriteSetWhenAborting(std::size_t const &size)
    {
       //lock(&abortTrackingMutex_);
- ThreadIdAndCommitId tcId(THREAD_ID, aborts_);
+ ThreadIdAndCommitId tcId(this_thread::get_id(), aborts_);
       abortedWriteSetSize_[tcId] = size;
- waitingForCommitWriteFromThread[THREAD_ID] = true;
+ waitingForCommitWriteFromThread[this_thread::get_id()] = true;
       //unlock(&abortTrackingMutex_);
    }
 
- void pushBackSizeOfReadSetWhenCommitting(uint32 const &size)
+ void pushBackSizeOfReadSetWhenCommitting(std::size_t const &size)
    {
       //lock(&abortTrackingMutex_);
- ThreadIdAndCommitId tcId(THREAD_ID, aborts_);
+ ThreadIdAndCommitId tcId(this_thread::get_id(), aborts_);
 
       // only insert this commit if an abort made an entry at this commit point
- if (waitingForCommitReadFromThread[THREAD_ID])
+ if (waitingForCommitReadFromThread[this_thread::get_id()])
       {
          committedReadSetSize_[tcId] = size;
- waitingForCommitReadFromThread[THREAD_ID] = false;
+ waitingForCommitReadFromThread[this_thread::get_id()] = false;
       }
       //unlock(&abortTrackingMutex_);
    }
 
- void pushBackSizeOfWriteSetWhenCommitting(uint32 const &size)
+ void pushBackSizeOfWriteSetWhenCommitting(std::size_t const &size)
    {
       //lock(&abortTrackingMutex_);
- ThreadIdAndCommitId tcId(THREAD_ID, aborts_);
+ ThreadIdAndCommitId tcId(this_thread::get_id(), aborts_);
 
       // only insert this commit if an abort made an entry at this commit point
- if (waitingForCommitWriteFromThread[THREAD_ID])
+ if (waitingForCommitWriteFromThread[this_thread::get_id()])
       {
          committedWriteSetSize_[tcId] = size;
- waitingForCommitWriteFromThread[THREAD_ID] = false;
+ waitingForCommitWriteFromThread[this_thread::get_id()] = false;
       }
       //unlock(&abortTrackingMutex_);
    }
@@ -232,26 +233,26 @@
    CommitHistory committedReadSetSize_;
    CommitHistory committedWriteSetSize_;
 
- std::map<uint32, bool> waitingForCommitReadFromThread;
- std::map<uint32, bool> waitingForCommitWriteFromThread;
+ std::map<thread_id_t, bool> waitingForCommitReadFromThread;
+ std::map<thread_id_t, bool> waitingForCommitWriteFromThread;
 
    thread_commit_map threadedCommits_;
    thread_commit_map threadedAborts_;
 
- uint32 aborts_;
- uint32 writeAborts_;
- uint32 readAborts_;
- uint32 abortPermDenied_;
- uint32 commits_;
- uint32 handOffs_;
- uint32 newMemoryCommits_;
- uint32 newMemoryAborts_;
- uint32 deletedMemoryCommits_;
- uint32 deletedMemoryAborts_;
- uint32 readStayedAsRead_;
- uint32 readChangedToWrite_;
- uint32 commitTimeMs_;
- uint32 lockConvoyMs_;
+ std::size_t aborts_;
+ std::size_t writeAborts_;
+ std::size_t readAborts_;
+ std::size_t abortPermDenied_;
+ std::size_t commits_;
+ std::size_t handOffs_;
+ std::size_t newMemoryCommits_;
+ std::size_t newMemoryAborts_;
+ std::size_t deletedMemoryCommits_;
+ std::size_t deletedMemoryAborts_;
+ std::size_t readStayedAsRead_;
+ std::size_t readChangedToWrite_;
+ clock_t commitTimeMs_;
+ clock_t lockConvoyMs_;
 
    //Mutex abortTrackingMutex_;
 };

Modified: sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -105,11 +105,11 @@
 #endif
 
 #if USE_STM_MEMORY_MANAGER
- void* operator new(size_t size, const std::nothrow_t&) throw ()
+ void* operator new(std::size_t size, const std::nothrow_t&) throw ()
    {
       return retrieve_mem(size);
    }
- void* operator new(size_t size) throw (std::bad_alloc)
+ void* operator new(std::size_t size) throw (std::bad_alloc)
     {
         void* ptr= retrieve_mem(size);
         if (ptr==0) throw std::bad_alloc;
@@ -119,7 +119,7 @@
    void operator delete(void* mem) throw ()
    {
       static Derived elem;
- static size_t elemSize = sizeof(elem);
+ static std::size_t elemSize = sizeof(elem);
       return_mem(mem, elemSize);
    }
 #endif

Modified: sandbox/stm/branches/vbe/boost/stm/transactional_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transactional_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transactional_object.hpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -104,11 +104,11 @@
     }
 
     #if USE_STM_MEMORY_MANAGER
- void* operator new(size_t size, const std::nothrow_t&) throw ()
+ void* operator new(std::size_t size, const std::nothrow_t&) throw ()
    {
       return retrieve_mem(size);
    }
- void* operator new(size_t size) throw (std::bad_alloc)
+ void* operator new(std::size_t size) throw (std::bad_alloc)
     {
         void* ptr= retrieve_mem(size);
         if (ptr==0) throw std::bad_alloc;
@@ -118,7 +118,7 @@
    void operator delete(void* mem) throw ()
    {
       static transactional_object<T> elem;
- static size_t elemSize = sizeof(elem);
+ static std::size_t elemSize = sizeof(elem);
       return_mem(mem, elemSize);
    }
     #endif

Modified: sandbox/stm/branches/vbe/libs/stm/src/contention_manager.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/src/contention_manager.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/src/contention_manager.cpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -59,9 +59,9 @@
 {
    if (txTryingToAbortIsIrrevocable) return true;
 #ifndef DISABLE_READ_SETS
- if ((size_t)lockWaitTime > rhs.read_set_size() + rhs.writes()) return true;
+ if ((clock_t)lockWaitTime > rhs.read_set_size() + rhs.writes()) return true;
 #else
- if ((size_t)lockWaitTime > 100 + 100 * rhs.writes()) return true;
+ if ((clock_t)lockWaitTime > 100 + 100 * rhs.writes()) return true;
 #endif
 
    else return false;

Modified: sandbox/stm/branches/vbe/libs/stm/src/except_and_back_off_on_abort_notice_cm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/src/except_and_back_off_on_abort_notice_cm.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/src/except_and_back_off_on_abort_notice_cm.cpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -190,9 +190,9 @@
       if (txTryingToAbortIsIrrevocable) return true;
 
 #ifndef DISABLE_READ_SETS
- if ((size_t)lockWaitTime > rhs.read_set_size() + 100 * rhs.writes())
+ if ((clock_t)lockWaitTime > rhs.read_set_size() + 100 * rhs.writes())
 #else
- if ((size_t)lockWaitTime > 100 * rhs.writes())
+ if ((clock_t)lockWaitTime > 100 * rhs.writes())
 #endif
       {
          return true;

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-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -36,7 +36,7 @@
 transaction::MutexSet transaction::tmConflictingLocks_;
 transaction::DeletionBuffer transaction::deletionBuffer_;
 
-size_t transaction::global_clock_ = 0;
+clock_t transaction::global_clock_ = 0;
 size_t transaction::stalls_ = 0;
 
 bool transaction::dynamicPriorityAssignment_ = false;
@@ -196,9 +196,9 @@
    // DO NOT REMOVE LOCK_ALL_MUTEXES / UNLOCK_ALL_MUTEXES!!
    //
    //--------------------------------------------------------------------------
- lock_all_mutexes_but_this(THREAD_ID);
+ lock_all_mutexes_but_this(this_thread::get_id());
 
- size_t threadId = THREAD_ID;
+ thread_id_t threadId = this_thread::get_id();
 
 #ifndef USE_SINGLE_THREAD_CONTEXT_MAP
 /////////////////////////////////
@@ -349,7 +349,7 @@
    tss_context_map_type::iterator memIter = tss_context_map_.find(threadId);
    if (tss_context_map_.end() == memIter)
    {
- tss_context_map_.insert(std::pair<size_t, tx_context*>(threadId, new tx_context));
+ tss_context_map_.insert(std::pair<thread_id_t, tx_context*>(threadId, new tx_context));
       memIter = tss_context_map_.find(threadId);
       memIter->second->txType = eNormalTx;
    }
@@ -360,7 +360,7 @@
    tss_context_map_type::iterator memIter = tss_context_map_.find(threadId);
    if (tss_context_map_.end() == memIter)
    {
- tss_context_map_.insert(std::pair<size_t, tss_context*>(threadId, new tss_context));
+ tss_context_map_.insert(std::pair<thread_id_t, tss_context*>(threadId, new tss_context));
       memIter = tss_context_map_.find(threadId);
       memIter->second->tx_.txType = eNormalTx;
    }
@@ -405,7 +405,7 @@
    // this will unlock the mutex of the thread that was just added, but it
    // doesn't matter because that mutex will already be unlocked
    //--------------------------------------------------------------------------
- unlock_all_mutexes_but_this(THREAD_ID);;
+ unlock_all_mutexes_but_this(this_thread::get_id());;
 
    //--------------------------------------------------------------------------
 
@@ -420,7 +420,7 @@
    synchro::lock_guard<Mutex> lock_i(*inflight_lock());
    //synchro::lock(*inflight_lock());
 
- size_t threadId = THREAD_ID;
+ thread_id_t threadId = this_thread::get_id();
 
 #ifndef USE_SINGLE_THREAD_CONTEXT_MAP
    ThreadWriteContainer::iterator writeIter = threadWriteLists_.find(threadId);

Modified: sandbox/stm/branches/vbe/libs/stm/test/stm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/stm.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/stm.cpp 2009-10-19 08:30:04 EDT (Mon, 19 Oct 2009)
@@ -270,7 +270,7 @@
 
    percentTotal = percentTotal / double(percentList.size());
 
- uint32 abortCount = transaction::bookkeeping().getAbortReadSetList().size()
+ std::size_t abortCount = transaction::bookkeeping().getAbortReadSetList().size()
       + transaction::bookkeeping().getAbortWriteSetList().size();
 
    aborts << typeOfRun.c_str() << " total_aborts: " << transaction::bookkeeping().totalAborts()


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