From d3d42c5f5445e304dcf2c81136e27b7bcfd8f660 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 8 Nov 2011 11:08:51 +0000 Subject: [PATCH] Use sm_decrementer to remove another explicit try/catch --- transaction_manager.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/transaction_manager.cc b/transaction_manager.cc index ba4f23a..4743bba 100644 --- a/transaction_manager.cc +++ b/transaction_manager.cc @@ -39,18 +39,11 @@ transaction_manager::write_ref transaction_manager::new_block(validator v) { block_address b = sm_->new_block(); - try { - add_shadow(b); - try { - return bm_->write_lock_zero(b, v); - } catch (...) { - remove_shadow(b); - throw; - } - } catch (...) { - sm_->dec(b); - throw; - } + sm_decrementer decrementer(sm_, b); + write_ref wr = bm_->write_lock_zero(b, v); + add_shadow(b); + decrementer.dont_bother(); + return wr; } // FIXME: make exception safe