Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60747 - in sandbox/stm/branches/vbe/libs/stm: example/tx src
From: vicente.botet_at_[hidden]
Date: 2010-03-21 12:54:43


Author: viboes
Date: 2010-03-21 12:54:42 EDT (Sun, 21 Mar 2010)
New Revision: 60747
URL: http://svn.boost.org/trac/boost/changeset/60747

Log:
Boost.STM/vbe:
* change random by rand which is more portable
* Use boost/thread.hpp
* Introduce BOOST_USES_STATIC_TSS
Text files modified:
   sandbox/stm/branches/vbe/libs/stm/example/tx/bank.cpp | 6 +++---
   sandbox/stm/branches/vbe/libs/stm/src/contention_manager.cpp | 3 ++-
   sandbox/stm/branches/vbe/libs/stm/src/transaction.cpp | 6 +++++-
   3 files changed, 10 insertions(+), 5 deletions(-)

Modified: sandbox/stm/branches/vbe/libs/stm/example/tx/bank.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/example/tx/bank.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/example/tx/bank.cpp 2010-03-21 12:54:42 EDT (Sun, 21 Mar 2010)
@@ -103,9 +103,9 @@
         {
             try {
                 BOOST_STM_E_TRANSACTION {
- int amount=random() % 1000;
- int acc1=random() % bank_->accounts.size();
- int acc2=random() % bank_->accounts.size();
+ int amount=rand() % 1000;
+ int acc1=rand() % bank_->accounts.size();
+ int acc2=rand() % bank_->accounts.size();
                     bank_->accounts[acc1]->Withdraw(amount);
                     bank_->accounts[acc2]->Deposit(amount+1);
                 } BOOST_STM_E_END_TRANSACTION;

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 2010-03-21 12:54:42 EDT (Sun, 21 Mar 2010)
@@ -13,7 +13,8 @@
 
 #include <boost/stm/contention_managers/contention_manager.hpp>
 #include <boost/stm/transaction.hpp>
-#include <pthread.h>
+//~ #include <pthread.h>
+#include <boost/thread/thread.hpp>
 
 //using namespace boost::stm;
 

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 2010-03-21 12:54:42 EDT (Sun, 21 Mar 2010)
@@ -31,8 +31,9 @@
 #endif
 }
 
+#ifndef BOOST_USES_STATIC_TSS
 synchro::implicit_thread_specific_ptr<transaction::transaction_tss_storage> transaction::transaction_tss_storage_;
-
+#endif
 ///////////////////////////////////////////////////////////////////////////////
 // Static initialization
 ///////////////////////////////////////////////////////////////////////////////
@@ -182,6 +183,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 void transaction::initialize_thread()
 {
+#ifdef BOOST_USES_STATIC_TSS
+ transaction_tss_storage_type::reset(new transaction_tss_storage());
+#endif
    synchro::lock_guard<Mutex> lock(*general_lock());
 
    //--------------------------------------------------------------------------


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