MCPcopy Create free account
hub / github.com/Tencent/MMKV / msync

Method msync

Core/MemoryFile_Win32.cpp:174–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174bool MemoryFile::msync(SyncFlag syncFlag) {
175 if (m_readOnly) {
176 // there's no point in msync() readonly memory
177 return true;
178 }
179 if (m_ptr) {
180 if (FlushViewOfFile(m_ptr, m_size)) {
181 if (syncFlag == MMKV_SYNC && openIfNeeded()) {
182 auto ret = FlushFileBuffers(m_diskFile.getFd());
183 if (!ret) {
184 MMKVError("fail to FlushFileBuffers [%s]:%d", m_diskFile.getUTF8Path().c_str(), GetLastError());
185 }
186 cleanMayflyFD();
187 return ret;
188 }
189 return true;
190 }
191 MMKVError("fail to FlushViewOfFile [%s]:%d", m_diskFile.getUTF8Path().c_str(), GetLastError());
192 return false;
193 }
194 return false;
195}
196
197bool MemoryFile::mmapOrCleanup(FileLock *fileLock) {
198 auto mode = m_readOnly ? PAGE_READONLY : PAGE_READWRITE;

Callers

nothing calls this directly

Calls 1

getFdMethod · 0.45

Tested by

no test coverage detected