|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59231 - sandbox/transaction/dev
From: strasser_at_[hidden]
Date: 2010-01-22 14:52:13
Author: stefans
Date: 2010-01-22 14:52:12 EST (Fri, 22 Jan 2010)
New Revision: 59231
URL: http://svn.boost.org/trac/boost/changeset/59231
Log:
same as 59230, submitted wrong local copy
Text files modified:
sandbox/transaction/dev/basic_transaction.hpp | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
Modified: sandbox/transaction/dev/basic_transaction.hpp
==============================================================================
--- sandbox/transaction/dev/basic_transaction.hpp (original)
+++ sandbox/transaction/dev/basic_transaction.hpp 2010-01-22 14:52:12 EST (Fri, 22 Jan 2010)
@@ -39,7 +39,6 @@
/// Throws: Nothing
/// \brief Destructs the basic_transaction object
~basic_transaction(){
- this->pop();
if(!this->done){
try{
TxMgr::rollback_transaction(this->tx);
@@ -49,6 +48,7 @@
#endif
}
}
+ this->pop();
}
/// If this is a nested transaction, sets the active transaction to the parent transaction.
@@ -58,9 +58,13 @@
/// \c archive_exception, \c io_failure, \c thread_resource_error, any exception thrown by the following user-supplied functions: \c T::T(), \c serialize(), \c save(), \c load(), \c construct(), \c equal(), \c finalize()
/// \brief Commits the transaction.
void commit(){
- this->pop();
this->done=true;
- TxMgr::commit_transaction(this->tx);
+ try{
+ TxMgr::commit_transaction(this->tx);
+ }catch(...){
+ this->pop();
+ throw;
+ }
}
/// If this is a nested transaction, sets the active transaction to the parent transaction.
@@ -69,9 +73,14 @@
/// Throws: \c io_failure, \c thread_resource_error
/// \brief Unwinds all changes made during this transaction.
void rollback(){
- this->pop();
this->done=true;
- TxMgr::rollback_transaction(this->tx);
+ try{
+ TxMgr::rollback_transaction(this->tx);
+ }catch(...){
+ this->pop();
+ throw;
+ }
+ this->pop();
}
/// Throws: Nothing
@@ -92,10 +101,8 @@
/// \cond
private:
void pop(){
- if(TxMgr::has_active_transaction() && &TxMgr::active_transaction() == &this->tx){
- if(this->parent) TxMgr::bind_transaction(*this->parent);
- else TxMgr::unbind_transaction();
- }
+ if(this->parent) TxMgr::bind_transaction(*this->parent);
+ else TxMgr::unbind_transaction();
}
typename TxMgr::transaction *parent;
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