From 461c2670efb0968ccc6789ff0c9ca6f88ab31e80 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Fri, 20 May 2011 16:19:04 -0400 Subject: kenlm update including being nicer to NFS --- klm/util/mmap.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'klm/util/mmap.cc') 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(); } } -- cgit v1.2.3