Ejemplo n.º 1
0
    /*static*/ void* MongoMMF::switchToPrivateView(void *readonly_ptr) { 
        assert( cmdLine.dur );
        assert( testIntent );

        void *p = readonly_ptr;

        {
            size_t ofs=0;
            MongoMMF *mmf = ourReadViews.find(p, ofs);
            if( mmf ) {
                void *res = ((char *)mmf->_view_private) + ofs;
                return res;
            }
        }

        {
            size_t ofs=0;
            MongoMMF *mmf = privateViews.find(p, ofs);
            if( mmf ) {
                log() << "dur: perf warning p=" << p << " is already in the writable view of " << mmf->filename() << endl;
                return p;
            }
        }

        // did you call writing() with a pointer that isn't into a datafile?
        log() << "dur error switchToPrivateView " << p << endl;
        return p;
    }
Ejemplo n.º 2
0
 /* switch to _view_write.  normally, this is a bad idea since your changes will not
    show up in _view_private if there have been changes there; thus the leading underscore
    as a tad of a "warning".  but useful when done with some care, such as during
    initialization.
 */
 void* MongoMMF::_switchToWritableView(void *p) {
     size_t ofs;
     MongoMMF *f = privateViews.find(p, ofs);
     assert( f );
     return (((char *)f->_view_write)+ofs);
 }