summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-02-09 13:35:34 -0500
committerdwight <dwight@10gen.com>2011-02-09 13:35:34 -0500
commit9ab78514ea2cd3f22c4cfa1fce0f30ec6345665b (patch)
treede178714fd32c0a558de07edca5cdd5379c116fe
parentd6bcf91f2f504298e8149c9b5523a79561ede075 (diff)
downloadmongo-9ab78514ea2cd3f22c4cfa1fce0f30ec6345665b.tar.gz
comments
-rw-r--r--util/mmap.cpp5
-rw-r--r--util/mmap.h8
2 files changed, 12 insertions, 1 deletions
diff --git a/util/mmap.cpp b/util/mmap.cpp
index 03b31975995..18edc342b5f 100644
--- a/util/mmap.cpp
+++ b/util/mmap.cpp
@@ -63,6 +63,11 @@ namespace mongo {
RWLock MongoFile::mmmutex("rw:mmmutex");
+ /* subclass must call in destructor (or at close).
+ removes this from pathToFile and other maps
+ safe to call more than once, albeit might be wasted work
+ ideal to call close to the close, if the close is well before object destruction
+ */
void MongoFile::destroyed() {
rwlock lk( mmmutex , true );
mmfiles.erase(this);
diff --git a/util/mmap.h b/util/mmap.h
index 8884a110ef4..393d67183ea 100644
--- a/util/mmap.h
+++ b/util/mmap.h
@@ -83,7 +83,13 @@ namespace mongo {
virtual Flushable * prepareFlush() = 0;
void created(); /* subclass must call after create */
- void destroyed(); /* subclass must call in destructor */
+
+ /* subclass must call in destructor (or at close).
+ removes this from pathToFile and other maps
+ safe to call more than once, albeit might be wasted work
+ ideal to call close to the close, if the close is well before object destruction
+ */
+ void destroyed();
virtual unsigned long long length() const = 0;