diff options
author | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
---|---|---|
committer | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
commit | 461c2670efb0968ccc6789ff0c9ca6f88ab31e80 (patch) | |
tree | 6b344dcf320674213fd449e6a4915236ad78c29f /klm/util/mmap.cc | |
parent | 0e7b303879baf95a8167194ad7c75ef738e79f15 (diff) |
kenlm update including being nicer to NFS
Diffstat (limited to 'klm/util/mmap.cc')
-rw-r--r-- | klm/util/mmap.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/klm/util/mmap.cc b/klm/util/mmap.cc index 456ce953..e7c0643b 100644 --- a/klm/util/mmap.cc +++ b/klm/util/mmap.cc @@ -15,8 +15,9 @@ namespace util { scoped_mmap::~scoped_mmap() { if (data_ != (void*)-1) { - if (munmap(data_, size_)) { - std::cerr << "munmap failed for " << size_ << " bytes." << std::endl; + // Thanks Denis Filimonov for pointing on NFS likes msync first. + if (msync(data_, size_, MS_SYNC) || munmap(data_, size_)) { + std::cerr << "msync or mmap failed for " << size_ << " bytes." << std::endl; abort(); } } |