Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56327 - in sandbox/stm/branches/vbe: boost/stm libs/stm/example
From: vicente.botet_at_[hidden]
Date: 2009-09-20 17:30:14


Author: viboes
Date: 2009-09-20 17:30:13 EDT (Sun, 20 Sep 2009)
New Revision: 56327
URL: http://svn.boost.org/trac/boost/changeset/56327

Log:
TBoost.Stm vbe
* fix bug on counter_ptr test

Text files modified:
   sandbox/stm/branches/vbe/boost/stm/transaction_object_ptr.hpp | 7 +------
   sandbox/stm/branches/vbe/boost/stm/tx_smart_ptr.hpp | 4 ++--
   sandbox/stm/branches/vbe/libs/stm/example/counter_ptr.cpp | 32 ++++++++++----------------------
   3 files changed, 13 insertions(+), 30 deletions(-)

Modified: sandbox/stm/branches/vbe/boost/stm/transaction_object_ptr.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction_object_ptr.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction_object_ptr.hpp 2009-09-20 17:30:13 EDT (Sun, 20 Sep 2009)
@@ -26,19 +26,14 @@
     typedef transaction_object_ptr<TO> this_type;
     typedef transaction_object<transaction_object_ptr<TO> > base_type;
     transaction_object_ptr() : base_type(), ptr_(0) {
- std::cout << "transaction_object_ptr "<< __LINE__ <<" " << __FILE__ << " "<< int(this) << std::endl;
     }
     transaction_object_ptr(const transaction_object_ptr & rhs) : base_type(rhs), ptr_(rhs.ptr_) {
- std::cout << "transaction_object_ptr "<< __LINE__ <<" " << __FILE__ << " "<< int(this) <<" "<< int(&rhs) << std::endl;
     }
     transaction_object_ptr(transaction_object_ptr & rhs) : base_type(rhs), ptr_(rhs.rhs) {
- std::cout << "transaction_object_ptr "<< __LINE__ <<" " << __FILE__ << " "<< int(this) <<" "<< int(&rhs) << std::endl;
     }
     transaction_object_ptr(TO* ptr) : base_type(), ptr_(ptr) {
- std::cout << "transaction_object_ptr "<<__LINE__ <<" " << __FILE__ << " "<< int(this) << std::endl;
     }
     ~transaction_object_ptr() {
- std::cout << "transaction_object_ptr "<<__LINE__ <<" " << __FILE__ << " "<< int(this) << std::endl;
     }
     this_type& operator=(TO* rhs) {
         ptr_=rhs;
@@ -51,7 +46,7 @@
     }
 
     inline TO& operator*() const { return *get(); }
- //inline TO* operator->() const { return get(); }
+ inline TO* operator->() const { return get(); }
     
     };
 

Modified: sandbox/stm/branches/vbe/boost/stm/tx_smart_ptr.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx_smart_ptr.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx_smart_ptr.hpp 2009-09-20 17:30:13 EDT (Sun, 20 Sep 2009)
@@ -47,11 +47,11 @@
 
     //
     template<class Y>
- tx_obj(tx_obj<Y> const& r) : obj_(r.ref()) {} // throws only if obj_ contructor throws
+ tx_obj(tx_obj<Y> const& r) : obj_(r.ref()) {}
 
     template <typename T1>
     tx_obj(T1 p1) : obj_(p1) {}
-
+ ~tx_obj() {}
     #if 0
     bool operator==(const tx_obj<T>& rhs) const {
         return this->ref()==rhs.ref();

Modified: sandbox/stm/branches/vbe/libs/stm/example/counter_ptr.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/example/counter_ptr.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/example/counter_ptr.cpp 2009-09-20 17:30:13 EDT (Sun, 20 Sep 2009)
@@ -72,9 +72,10 @@
     }
     bool res=true;
     use_atomic(_) {
- //read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
- //read_ptr<tx_int_ptr> tx_counter2_ptr_ptr(_, counter2_ptr);
- //res = (tx_counter2_ptr_ptr==tx_counter2_ptr_ptr) ;
+ //res = (counter2_ptr==counter_ptr) ;
+ read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
+ read_ptr<tx_int_ptr> tx_counter2_ptr_ptr(_, counter2_ptr);
+ //res = (*tx_counter2_ptr_ptr==*tx_counter_ptr_ptr) ;
         //res= (_.read(counter_ptr)==_.read(counter2_ptr));
     }
     return res;
@@ -97,35 +98,22 @@
 int test_counter() {
     use_atomic(_) {
         write_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
- _.throw_if_forced_to_abort_on_new();
- //tx_int* tmp=_.as_new(new tx_int());
- //tx_int* tmp=&counter;
- *tx_counter_ptr_ptr=_.as_new(new tx_int());
- //*tx_counter_ptr_ptr=&counter;
- std::cout << __LINE__ <<" " << __FILE__ << std::endl;
-
- //(_.write(counter_ptr)).ptr_=_.as_new(new tx_int());
+ *tx_counter_ptr_ptr=BOOST_STM_NEW(_, tx_int());
     }
- std::cout << __LINE__ <<" " << __FILE__ << std::endl;
     thread th1(inc);
     thread th2(decr);
-#if 0
     thread th3(inc);
     thread th4(inc);
-#endif
 
     th1.join();
     th2.join();
-#if 0
     th3.join();
     th4.join();
-#endif
- std::cout << __LINE__ <<" " << __FILE__ << std::endl;
- bool fails=false;
- std::cout << __LINE__ <<" " << __FILE__ << std::endl;
- fails=fails || check(0);
- //fails = fails || !assign();
- //fails = fails || !test_const(counter);
+
+ int fails=0;
+ fails += check(1);
+ fails += !assign();
+ //fails += !test_const(counter);
     return fails;
 }
 


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