|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57032 - sandbox/stm/branches/vbe/libs/stm/example
From: vicente.botet_at_[hidden]
Date: 2009-10-21 04:00:18
Author: viboes
Date: 2009-10-21 04:00:18 EDT (Wed, 21 Oct 2009)
New Revision: 57032
URL: http://svn.boost.org/trac/boost/changeset/57032
Log:
TBoost.STM vbe: Fix counter_ptr example test
Text files modified:
sandbox/stm/branches/vbe/libs/stm/example/counter_ptr.cpp | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
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-10-21 04:00:18 EDT (Wed, 21 Oct 2009)
@@ -32,74 +32,74 @@
void inc() {
thread_initializer thi;
- use_atomic(_) {
+ atomic(_) {
// ++(*counter_ptr)
read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
//tx_int_ptr tmp = *tx_counter_ptr_ptr;
write_ptr<tx_int> tx_counter_ptr(_, **tx_counter_ptr_ptr);
++(*tx_counter_ptr);
- }
+ } end_atom
}
void decr() {
thread_initializer thi;
- use_atomic(_) {
+ atomic(_) {
// --(*counter_ptr)
read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
write_ptr<tx_int> tx_counter_ptr(_, **tx_counter_ptr_ptr);
--(*tx_counter_ptr);
- }
+ } end_atom
}
bool check(int val) {
//thread_initializer thi;
bool res;
- use_atomic(_) {
+ atomic(_) {
// *counter_ptr==val
read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
read_ptr<tx_int> tx_counter_ptr(_, **tx_counter_ptr_ptr);
res =(*tx_counter_ptr==val);
- }
+ } end_atom
return res;
}
bool assign() {
//thread_initializer thi;
- use_atomic(_) {
+ atomic(_) {
// *tx_counter2_ptr=*tx_counter_ptr;
read_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
write_ptr<tx_int_ptr> tx_counter2_ptr_ptr(_, counter2_ptr);
tx_counter2_ptr_ptr=tx_counter_ptr_ptr;
- }
+ } end_atom
bool res=true;
- use_atomic(_) {
+ atomic(_) {
//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));
- }
+ } end_atom
return res;
}
#if 0
bool test_const(tx_int_const_ptr& const ptr) {
//thread_initializer thi;
- use_atomic(_) {
+ atomic(_) {
write_ptr<tx_int_const_ptr> tx_counter_const_ptr_ptr(_, counter_const_ptr);
tx_counter_const_ptr_ptr=ptr;
- }
+ } end_atom
bool res=true;
- use_atomic(_) {
+ atomic(_) {
//res =(c==counter2) ;
- }
+ } end_atom
return res;
}
#endif
int test_counter() {
- use_atomic(_) {
+ atomic(_) {
write_ptr<tx_int_ptr> tx_counter_ptr_ptr(_, counter_ptr);
*tx_counter_ptr_ptr=BOOST_STM_NEW(_, tx_int());
- }
+ } end_atom
thread th1(inc);
thread th2(decr);
thread th3(inc);
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