BIND 10 trac2831, updated. bb5479f56b9bdab1eff81e8ecca1d8e703a9ef50 [2831] make sure flushing memory before unmapping.
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Mar 12 20:31:15 UTC 2013
The branch, trac2831 has been updated
via bb5479f56b9bdab1eff81e8ecca1d8e703a9ef50 (commit)
from 2fb93c012e0c3f8a5e8e0fff208abe5685b7d4ce (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bb5479f56b9bdab1eff81e8ecca1d8e703a9ef50
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Tue Mar 12 13:30:54 2013 -0700
[2831] make sure flushing memory before unmapping.
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/memory_segment_mapped.cc | 4 ++++
src/lib/util/memory_segment_mapped.h | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/memory_segment_mapped.cc b/src/lib/util/memory_segment_mapped.cc
index 1d912d0..9aed111 100644
--- a/src/lib/util/memory_segment_mapped.cc
+++ b/src/lib/util/memory_segment_mapped.cc
@@ -51,6 +51,7 @@ struct MemorySegmentMapped::Impl {
void growSegment() {
// We first need to unmap it before calling grow().
const size_t prev_size = base_sgmt_->get_size();
+ base_sgmt_->flush();
base_sgmt_.reset();
const size_t new_size = prev_size * 2;
@@ -113,6 +114,9 @@ MemorySegmentMapped::MemorySegmentMapped(const std::string& filename,
}
MemorySegmentMapped::~MemorySegmentMapped() {
+ if (impl_->base_sgmt_ && !impl_->read_only_) {
+ impl_->base_sgmt_->flush(); // note: this is exception free
+ }
delete impl_;
}
diff --git a/src/lib/util/memory_segment_mapped.h b/src/lib/util/memory_segment_mapped.h
index a32b5cb..e569738 100644
--- a/src/lib/util/memory_segment_mapped.h
+++ b/src/lib/util/memory_segment_mapped.h
@@ -91,7 +91,12 @@ public:
MemorySegmentMapped(const std::string& filename, bool create,
size_t initial_size = INITIAL_SIZE);
- /// \brief Destructor
+ /// \brief Destructor.
+ ///
+ /// If the object was constructed in the read-write mode and the underlying
+ /// memory segment wasn't broken due to an exceptional event, the
+ /// destructor ensures the content of the mapped memory is written back to
+ /// the corresponding file.
virtual ~MemorySegmentMapped();
/// \brief Allocate/acquire a segment of memory.
More information about the bind10-changes
mailing list