Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56748 - in sandbox/stm/branches/vbe/boost/stm: . detail
From: vicente.botet_at_[hidden]
Date: 2009-10-12 13:54:24


Author: viboes
Date: 2009-10-12 13:54:23 EDT (Mon, 12 Oct 2009)
New Revision: 56748
URL: http://svn.boost.org/trac/boost/changeset/56748

Log:
TBoost.Stm vbe
* factoring throw_if_forced_to_abort_on_new and make_irrevocable in new_shared_memory
Text files modified:
   sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp | 3 +
   sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 41 +++++++++++----------------------------
   2 files changed, 14 insertions(+), 30 deletions(-)

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-12 13:54:23 EDT (Mon, 12 Oct 2009)
@@ -738,7 +738,8 @@
 {
    if (direct_updating())
    {
- bool wasWriting = isWriting() ? true : false;
+ //bool wasWriting = isWriting() ? true : false;
+ bool wasWriting = isWriting();
 
       if (wasWriting) lock(general_lock());
       lock_tx();

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-12 13:54:23 EDT (Mon, 12 Oct 2009)
@@ -710,33 +710,6 @@
    //--------------------------------------------------------------------------
 
    //--------------------------------------------------------------------------
- template <typename T>
- T* new_shared_memory(T*)
- {
- if (forced_to_abort())
- {
- if (!direct_updating())
- {
- deferred_abort(true);
- throw aborted_tx("");
- }
-
-#ifndef DELAY_INVALIDATION_DOOMED_TXS_UNTIL_COMMIT
- cm_abort_on_new(*this);
-#endif
- }
-
- make_irrevocable();
-
- T *newNode = new T;
- newNode->transaction_thread(threadId_);
- newNode->new_memory(1);
- newMemoryList().push_back(newNode);
-
- return newNode;
- }
-
- //--------------------------------------------------------------------------
     void throw_if_forced_to_abort_on_new() {
         if (forced_to_abort()) {
             if (!direct_updating()) {
@@ -759,6 +732,16 @@
 
       return newNode;
    }
+
+ //--------------------------------------------------------------------------
+ template <typename T>
+ T* new_shared_memory(T*)
+ {
+ throw_if_forced_to_abort_on_new();
+ make_irrevocable();
+ return as_new(new T());
+ }
+
    //--------------------------------------------------------------------------
    template <typename T>
    T* new_memory(T*)
@@ -775,7 +758,7 @@
       return as_new(new T(rhs));
    }
 
-
+ //--------------------------------------------------------------------------
    void begin();
    bool restart();
 
@@ -786,6 +769,7 @@
    }
 
    void end();
+ void commit() {end();}
    void no_throw_end();
 
    void force_to_abort()
@@ -809,7 +793,6 @@
 #endif
 #endif
    }
-
    inline void unforce_to_abort() { forced_to_abort_ref() = false; }
 
    //--------------------------------------------------------------------------


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