diff options
Diffstat (limited to 'src/mongo/db/pagefault.h')
-rw-r--r-- | src/mongo/db/pagefault.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mongo/db/pagefault.h b/src/mongo/db/pagefault.h new file mode 100644 index 00000000000..8bbf4ecab52 --- /dev/null +++ b/src/mongo/db/pagefault.h @@ -0,0 +1,46 @@ +// @file pagefault.h + +// define this : _PAGEFAULTEXCEPTION + +#pragma once + +namespace mongo { + + class Record; + + class PageFaultException /*: public DBException*/ { + unsigned era; + Record *r; + public: + PageFaultException(const PageFaultException& rhs) : era(rhs.era), r(rhs.r) { } + explicit PageFaultException(Record*); + void touch(); + }; + + class PageFaultRetryableSection : boost::noncopyable { + PageFaultRetryableSection *old; + public: + unsigned _laps; + PageFaultRetryableSection(); + ~PageFaultRetryableSection(); + }; +#if 0 + inline void how_to_use_example() { + // ... + { + PageFaultRetryableSection s; + while( 1 ) { + try { + writelock lk; // or readlock + // do work + break; + } + catch( PageFaultException& e ) { + e.touch(); + } + } + } + // ... + } +#endif +} |