@@ -465,8 +465,6 @@ class MappedFile::Impl
465465 , mRegion (mMap , boost::interprocess::read_only)
466466 , mAutoDelete (autoDelete)
467467 {
468- mLastWriteTime = this ->getLastWriteTime ();
469-
470468 if (mAutoDelete ) {
471469#ifndef _WIN32
472470 // On Unix systems, unlink the file so that it gets deleted once it is closed.
@@ -493,37 +491,13 @@ class MappedFile::Impl
493491 }
494492 }
495493
496- Index64 getLastWriteTime () const
497- {
498- Index64 result = 0 ;
499- const char * filename = mMap .get_name ();
500-
501- #ifdef _WIN32
502- // boost::interprocess::detail was renamed to boost::interprocess::ipcdetail in Boost 1.48.
503- using namespace boost ::interprocess::detail;
504- using namespace boost ::interprocess::ipcdetail;
505-
506- if (void * fh = open_existing_file (filename, boost::interprocess::read_only)) {
507- struct { unsigned long lo, hi; } mtime; // Windows FILETIME struct
508- if (GetFileTime (fh, nullptr , nullptr , &mtime)) {
509- result = (Index64 (mtime.hi ) << 32 ) | mtime.lo ;
510- }
511- close_file (fh);
512- }
513- #else
514- struct stat info;
515- if (0 == ::stat (filename, &info)) {
516- result = Index64 (info.st_mtime );
517- }
518- #endif
519- return result;
520- }
521-
522494 boost::interprocess::file_mapping mMap ;
523495 boost::interprocess::mapped_region mRegion ;
524496 bool mAutoDelete ;
525497 Notifier mNotifier ;
498+ #if OPENVDB_ABI_VERSION_NUMBER <= 12
526499 mutable std::atomic<Index64> mLastWriteTime ;
500+ #endif
527501
528502private:
529503 Impl (const Impl&); // not copyable
@@ -554,18 +528,6 @@ MappedFile::filename() const
554528SharedPtr<std::streambuf>
555529MappedFile::createBuffer () const
556530{
557- #ifndef _WIN32
558- if (!mImpl ->mAutoDelete && mImpl ->mLastWriteTime > 0 ) {
559- // Warn if the file has been modified since it was opened
560- // (but don't bother checking if it is a private, temporary file).
561- if (mImpl ->getLastWriteTime () > mImpl ->mLastWriteTime ) {
562- OPENVDB_LOG_WARN (" file " << this ->filename () << " might have changed on disk"
563- << " since it was opened" );
564- mImpl ->mLastWriteTime = 0 ; // suppress further warnings
565- }
566- }
567- #endif
568-
569531 return SharedPtr<std::streambuf>{
570532 new boost::iostreams::stream_buffer<boost::iostreams::array_source>{
571533 static_cast <const char *>(mImpl ->mRegion .get_address ()), mImpl ->mRegion .get_size ()}};
0 commit comments