[persistent-data/block] ::exit() if write_ref drops below zero

We were throwing before, which obviously isn't allowed in a destructor.
This commit is contained in:
Joe Thornber 2017-03-13 13:18:44 +00:00
parent 4493d6d39d
commit 73ae456175

View File

@ -188,8 +188,10 @@ namespace persistent_data {
block_manager<BlockSize>::write_ref::~write_ref() block_manager<BlockSize>::write_ref::~write_ref()
{ {
if (ref_count_) { if (ref_count_) {
if (!*ref_count_) if (!*ref_count_) {
throw std::runtime_error("write_ref ref_count going below zero"); std::cerr << "write_ref ref_count going below zero";
::exit(1);
}
(*ref_count_)--; (*ref_count_)--;
} }